So I was learning remoteEvents, and I wanted to make it so when some touches a part, then it triggers a local script which will print receive, and will also make the frame go visible. The problem, is that it will print receive, but it won't make the frame visible. Why? Script...
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent").OnClientEvent:Connect(function() game.StarterGui.ScreenGui.Frame.Visible = true print("received ") end)
When you spawn, GUIs are cloned from StarterGui into your PlayerGui, this means that if you change StarterGui you are not changing the current GUI but rather the one that you will get the next time you spawn, this is nicht gut, in order to solve it you simply need to change PlayerGui:
game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function() game:GetService("Players").LocalPlayer.PlayerGui.Frame.Visible = true print("received ") end)
And don't use WaitForChild for anything in ReplicatedStorage, there is no need at all.