#How can I
10 messages · Page 1 of 1 (latest)
I messed up the title lol sorry
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
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
@ember kraken I allow myself to ping you
Switch the dotnav out to a way it can reach the player in all possible circumstances (hint, tools can be both in the backpack and character)
** You are now Level 1! **