I’m trying to make a script that changes the ClockTime, however, when I touch the object, nothing happens.
local sethours = 14
script.Parent.Touched:Connect(function()
game.Lighting.ClockTime = sethours
end)
I’m trying to make a script that changes the ClockTime, however, when I touch the object, nothing happens.
local sethours = 14
script.Parent.Touched:Connect(function()
game.Lighting.ClockTime = sethours
end)
Any chance the ClockTime is already 14 so you’re just not seeing a change?
It could be that another part has already triggered the Part and thus sets to 14 even if you specifically didn’t touch it? You may need some touch verification
StarterPlayerScripts.
3030303030
I looked at the ClockTime ingame, no change.
Your script is in StarterPlayerScripts?
There are no other parts touching it.
Your script uses script.Parent.Touched, it must be inside your part
Yes, it is in StarterPlayerScripts.
There are no errors, by the way.
Wait why is there a part in StarterPlayerScripts? I think that could be it, can’t you put the part in workspace and reference it from there?
Wait, hold on let me check again…
The .Touched
event exists for BaseParts. StarterPlayerScripts is a game service it can’t be “Touched”.
the part doesnt even show up when in Lighting
My bad, the script is actually in the part.
I mixed up another script with it, I’m kind of dumb lol
As EmbatTheHybrid mentioned, was the ClockTime already 14 before the you touched the part?
Is the script a LocalSCript or a regular script?
Nope, ClockTime never changed.
The script is a LocalScript.
303030
LocalScripts do not work in workspace, use a regular script or put it i nStarterPlayerScripts and change it around
The LocalScript is inside the part that is being touch detected.