#Flashlight limited to one player? + Vanishing tool...

17 messages · Page 1 of 1 (latest)

unique quest
#

Issue 1: My flashlight is limited to one player. I had my friends join my test server and when we all went to grab the flashlight it would only let one person hold it.

Example: Person 1 grabs flashlight. Then Person 2 grabs flashlight. Person 1 gets flashlight taken away, and Person 2 would have the flashlight. I'll edit this message to let you know if it was a server bug like the issue 2.

Issue 2: Sometimes it bugs out and goes invisible, and in some servers you cannot even pick up the flashlight at all. [see images]

Here is my script btw.

Proximitypromt to grab flashlight tool. (Located in workspace alongside a model of the light where you're prompted to grab it. The model is for looks and is not the flashlight you're grabbing.)

local ProximityPrompt = script.Parent
local Item = game.ServerStorage.Tools:FindFirstChild("Flashlight")
ProximityPrompt.Triggered:Connect(function(player)
    Item.Parent = player.Backpack
end)

Flashlight Tool's LocalScript. (located in ServerStorage > Tools folder > Flashlight (a tool) > "LightScript" (a LocalScript)

script.Parent.Activated:Connect(function()
    if script.Parent.Handle.SpotLight.Enabled == true then
        script.Parent.Handle.SpotLight.Enabled = false
        script.Parent.Handle.click:Play()
    else
        script.Parent.Handle.SpotLight.Enabled = true
        script.Parent.Handle.click:Play()
    end
end)
script.Parent.Equipped:Connect(function()
    script.Parent.Handle.SpotLight.Enabled = false
    script.Parent.Handle.grab:Play()
end)
script.Parent.Unequipped:Connect(function()
    script.Parent.Handle.grab:Play()
end)

[Images below this are locations of my scripts, just incase.]

#

2nd image under workspace

I want to add that I know nothing about scripting and how I managed to get this far with a few tutorials and documentation reads is a wonder to me

#

Flashlight limited to one player? + Vanishing tool...

hushed fable
#

Prompt script:

local ProximityPrompt = script.Parent
local Item = game.ServerStorage.Tools:FindFirstChild("Flashlight")
ProximityPrompt.Triggered:Connect(function(player)
    Item.Parent = player.Backpack
end)```

Flashlight script:
```lua
script.Parent.Activated:Connect(function()
    if script.Parent.Handle.SpotLight.Enabled == true then
        script.Parent.Handle.SpotLight.Enabled = false
        script.Parent.Handle.click:Play()
    else
        script.Parent.Handle.SpotLight.Enabled = true
        script.Parent.Handle.click:Play()
    end
end)
script.Parent.Equipped:Connect(function()
    script.Parent.Handle.SpotLight.Enabled = false
    script.Parent.Handle.grab:Play()
end)
script.Parent.Unequipped:Connect(function()
    script.Parent.Handle.grab:Play()
end)```
#

first of all I recommend storing items in replicated storage

#

what you wanna do is clone it

#
local ProximityPrompt = script.Parent
local Item = game.ServerStorage.Tools:FindFirstChild("Flashlight")
ProximityPrompt.Triggered:Connect(function(player)
    local newItem = Item:Clone()
    newItem.Parent = player.Backpack
end)```
#

so if one person takes it

#

its not taking from the original

#

because theres only 1

#

if u clone it u can give out as amny as you want

unique quest
hushed fable
#

just do

#

if not player.Backpack:FindFindFirstChild("Flashligjt")

#

then the script for giving it

unique quest
# hushed fable if not player.Backpack:FindFindFirstChild("Flashligjt")

I felt confident and tried to make the flashlight model vanish after grabbing it 💀

it worked at first but it gave me two, i think it's cuz i have local new.Item = Item:Clone() and "newItem.Parent = player.Backpack on here twice,, but now it doesn't show the prompt haha

i'm absolute cheeks at this cuz i've only been using studio for 2 months but erm yeah.. i should of probably left it alone 🤣

script in the image:

(prompt script)

local ProximityPrompt = script.Parent
local Item = game.ReplicatedStorage.Tools:FindFirstChild("Flashlight")
ProximityPrompt.Triggered:Connect(function(player)
    local newItem = Item:Clone()
    if not player.Backpack:FindFirstChild("Flashlight") then
            newItem.Parent = player.Backpack
    end
    ProximityPrompt.Enabled = false
    script.Parent.Parent.Parent.FlBase.Transparency = 1
    script.Parent.Parent.Parent.FlPart.Transparency = 1
    script.Parent.Parent.Parent.FlRing.Transparency = 1
    local new.Item = Item:Clone()
    newItem.Parent = player.Backpack
    end)

I also tried this but erm, yeah, I dunno

local ProximityPrompt = script.Parent
local Item = game.ReplicatedStorage.Tools:FindFirstChild("Flashlight")
ProximityPrompt.Triggered:Connect(function(player)
    local newItem = Item:Clone()
    if not player.Backpack:FindFirstChild("Flashlight") then
    script.Parent.Parent.Parent.FlBase.Transparency = 1
    script.Parent.Parent.Parent.FlPart.Transparency = 1
    script.Parent.Parent.Parent.FlRing.Transparency = 1 
    script.Parent.Parent.ProximityPrompt = false
    end
end)

i might just be running around the answer

unique quest
#

oh, this works

local Item = game.ReplicatedStorage.Tools:FindFirstChild("Flashlight")
ProximityPrompt.Triggered:Connect(function(player)
    local newItem = Item:Clone()
    if not player.Backpack:FindFirstChild("Flashlight") then
            newItem.Parent = player.Backpack
    end
    ProximityPrompt.Enabled = false
    script.Parent.Parent.Parent.FlBase.Transparency = 1
    script.Parent.Parent.Parent.FlPart.Transparency = 1
    script.Parent.Parent.Parent.FlRing.Transparency = 1
end)

:D