I’m pretty new with scripting and I’ve been experimenting with RemoteEvents. Before, the GUI would only show on the client-side when I wanted it to show on both the client and server. Now, I tried it again and it only shows on the server-side instead.
print("picked up")
for i = 1,100 do
game.StarterGui.Fade.Blackness.BackgroundTransparency = game.StarterGui.Fade.Blackness.BackgroundTransparency - 0.01
wait()
end
wait(3)
for i = 1,100 do
game.StarterGui.Fade.Blackness.BackgroundTransparency = game.StarterGui.Fade.Blackness.BackgroundTransparency + 0.01
wait(5)
game.Lighting.TimeOfDay = "14:30:00"
end
end)
I’ve made this mistake before too. The way StarterGui works is that when a player enters the game, everything in there gets copied over to the client. So what you are doing is actually working, but you are only changing the thing that it gets copied from so you will never see those changes. As a rule of thumb, scripting UI will pretty much only ever be done with local scripts. So instead of game.StarterGui.Fade, the real path is game.Players.Sean_Ibgl.PlayerGui.Fade or since you’re on the client game.Players.LocalPlayer.PlayerGui.Fade. Hope this helps!
Exactly, you can fix this by adding the following lines to the localscript.
local playerGui = game.Players.LocalPlayer.PlayerGui
for i = 1,100 do
playerGui.Fade.Blackness.BackgroundTransparency -= 0.01 -- You can also say += to add something and -= to subtract something, the same for multiplying, like *=
wait()
end
wait(3)
for i = 1,100 do
playerGui.Fade.Blackness.BackgroundTransparency += 0.01 -- Here I do +=, so I add something
end
wait(5) -- I assume you want to wait 5 seconds after that the fade happened, not that every frame for the fade is 5 seconds
game.Lighting.TimeOfDay = "14:30:00" -- Place this in the server script if you'd like the effect to happen to everyone, keep it in the localscript if you only want to change the time for that specific player
Also, make sure to delete the old code out of the serverscript
I hope this helped you, good luck with your project!
Edit: Make sure to place everything in the mousebutton event!