#How can I

10 messages · Page 1 of 1 (latest)

dawn spearBOT
#

studio** You are now Level 1! **studio

spark fox
#

I messed up the title lol sorry

ember kraken
#

Does every flashlight have 1 of these scripts?

#

(The server ones)

#

If so then that’s your issue, you never check what flashlight to turn on/off. As all run off of 1 re.
An easy fix would be to just use
if game.Players:GetPlayerFromCharacter(FlashLight.Parent) ~= player or Flashlight.Parent.Parent ~= player then return end

(checks if this script is inside the right character, if not then stop the function)
It does depend

spark fox
#

Yes every flashlight have the same scripts, they're all exactly the same. I pasted your code in the server script like this :

#
local RemoteEvent = game.ReplicatedStorage:WaitForChild("Flashlight")
local Spotlight = script.Parent.Parent.SpotLight
local Flashlight = script.Parent.Parent.Parent.Parent.Flashlight



RemoteEvent.OnServerEvent:Connect(function(player, SpotLight)
    if game.Players:GetPlayerFromCharacter(Flashlight.Parent) ~= player or Flashlight.Parent.Parent ~= player then return end 
    if Spotlight.Enabled then
        Spotlight.Enabled = false
        print("Flashlight disabled on server")
    else Spotlight.Enabled = true
        print("Flashlight enabled on server")
    end
end)```
#

Now it straight up doesn't work, I can't turn them on and off

spark fox
#

@ember kraken I allow myself to ping you

ember kraken