I have tried many times and have a script that just doesn't work
1 | local part = script.Parent |
2 |
3 | part.Touched:Connect( function (hit) |
4 | print ( "Time part was touched by" .. hit.Name) |
5 | game.Lighting.ClockTime = 14 |
What have I done wrong?
This a basic syntax error I highly suggest you open the output for debugging. Also format your code correctly
1 | local part = script.Parent |
2 |
3 | part.Touched:Connect( function (hit) |
4 | print ( "Time part was touched by" .. hit.Name) |
5 | game.Lighting.ClockTime = 14 |
6 | end ) -- You need to end the function |
01 | local Players = game:GetService( "Players" ) |
02 | local part |
03 |
04 | script.parent.Touched:Connect( function (part) |
05 |
06 | local player = Players:GetPlayerFromCharacter(part.Parent) |
07 | if not player then return end |
08 |
09 | print ( "Time was changed by " .. player.Name) |
10 | game.Lighting.ClockTime = math.random( 23 ) |
11 | end ) |
Something like this.