I was using tables, and decided to switch incase that made a difference, which it didn’t!
Script:
local lever = workspace.Lever
local dayLever = lever.DayLever
local nightLever = lever.NightLever
local clickDetector = lever.MainLever.ClickDetector
game.Players.PlayerAdded:Connect(function(player)
local isNight = Instance.new("BoolValue",player)
isNight.Name = "IsNight"
end)
clickDetector.MouseClick:Connect(function(player)
if not player.IsNight.Value then
game.ReplicatedStorage.Remotes.Events.UpdateTime:FireClient(player,"20:30:00","MAKE_NIGHT")
player.IsNight.Value = true
else
game.ReplicatedStorage.Remotes.Events.UpdateTime:FireClient(player,"12:30:00","MAKE_DAY")
player.IsNight.Value = false
end
end)
The code you provided doesn’t seem to fiddle with the ClickDetector aside from properly connecting to MouseClick. Perhaps you should double check that the CD is present at run-time (check the Workspace) and that you’re close enough (MaxActivationDistance) to trigger it.
Edit: Also ensure that you have a LocalScript which ahs connected to your UpdateTime event - I can’t remember if FireClient blocks the thread if nothing’s listening on the other end. If this is the problem you could in theory set IsNight.Value first, then call FireClient.
Oh, that’s strange. I see you have two separate levers for night and day when the code implies the same lever is used for both. Perhaps that could be causing you issues.