Script can't find the time

in the part.
-----Character limit-----

u might wanna give us more context about the part where its located and ur new script after some changes

The script is inside the part that contains the spotlight, beam and attachments. That part is in a model.
At the moment, the script is the most recent post sent by exercitus.
For whatever reason, my script still doesn’t work while his does.

can we see the new script? after some of our suggestions, surely the script has changed, can we see the new one?

1 Like
local Lighting = game:GetService("Lighting")
local Light = script.Parent
local Beam = Light.Beam
local SL = Light.SpotLight

Lighting.Changed:Connect(function(Change)
	if Change == "ClockTime" then
		if Lighting.ClockTime >= 18 or Lighting.ClockTime <= 6 then -- Time values
			Light.Transparency = 0
			Beam.Enabled = true
			SL.Enabled = true
			task.wait(1)
		else
			Light.Transparency = 0.6
			Beam.Enabled = false
			SL.Enabled = false
			task.wait(1)
		end
	end
end)
	

1 Like

That is the current script. I have followed each of the suggestions and none of them seemed to have worked. The closest i got to the script working is when i finished off the statement (ofc) and after that its just been a roadblock. It doesnt check the script again after the time is changed.

(its missing the lights ofc, but i did it just to check)

Can you try my snippet? It should work. Also what type of script are you using? Local or Server?

1 Like

if this script works for u and u wanna use it , change the (for i = 1,10) to (while true)
if that script also dont work, this maybe not the case but just to make sure, try running the game and check if the part the script in is falling off the map and disappearing, or right click the script while the game is running and click (locate script) to check if its still in the game after some time

1 Like

The script worked, although it doesn’t actually loop it at all. I have tried changing it into (while true do)

It doesn’t work. Its a server script.

What doesn’t work? Does the lightning even change at all?

1 Like

The lighting doesnt change whatsoever.

u mean the game.Lighting.ClockTime doesnt change at all?, if thats the case, this script have nothing to do with that

1 Like

No. The clocktime changes but the script doesn’t detect it changing.

Miraculously, something has fixed. The script now works. I genuinely dont know what.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.