So i recently been working on a new thing for when someone clicks a GUI Button it teleports them, here's the code
function onClicked()
script.Parent.Parent.Parent:Destroy()
game.Workspace.Menu:Stop()
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
game.Workspace:FindFirstChild("Torso").Cframe = Vector3.new(0, 50, 0)
end
script.Parent.MouseButton1Click:connect(onClicked)
Then here's the error
12:35:51.600 - Players.Player1.PlayerGui.Menu.Play.LocalScript:6: attempt to index a nil value
12:35:51.602 - Stack Begin
12:35:51.604 - Script 'Players.Player1.PlayerGui.Menu.Play.LocalScript', Line 6
12:35:51.605 - Stack End
I've tried changing stuff around to fix it but nothing works.
Also how do we freeze a player when they spawn then unfreeze them -> then teleport them? I know i can use wait(5) to give the script some time to unfreeze the player but there's no wiki to telling me how to freeze a player from moving during he play screen.
