✓ Accepted answer
Errors
In your script you made a function a Variable which won't work, you also added game.Players.Player.PlayerGui, player in this case, would be nil, because when you joined the server there would be no player so what would we do? We would use game.Players.LocalPlayer It finds the LocalPlayer which is you, But please note that LocalPlayer Only works in a LocalScript.
Perfections
local play=script.Parent
plr=game.Players.LocalPlayer
chr=plr.Character
play.Text="HELLO"
play.MouseButton1Down:connect(function()
wait(.1)
play.Text="You will respawn in 3 seconds"
wait(3)
plr.PlayerGui.ScreenGui:remove()
wait(.2)
plr.CameraMaxZoomDistance=0.5
plr.CameraMinZoomDistance=0.5
chr.Humanoid.Died:connect(function()
plr.CameraMaxZoomDistance=400
plr.CameraMinZoomDistance=0.5
end)
end)
Ok so what I've added here is your playgui/button, then the LocalPlayer that I was talking about earlier, as you can see I added plr.CameraMaxZoomDistance=0.5 instead of using game.StarterPlayer, its because StarterPlayer, sets it up before the player ever joins and when the server is running it can not be changed again(when on server). I added a chr.Humanoid.Died function so that it won't be in FPS mode when you respawn.
please note that this is in a LocalScript
If there are any errors just Comment below.
2 comments
I'm not entirely sure if it's just my browser not loading propperly or you havn't, But please do put your code in the code block...
If my Answer helped please upvote!