Is there a possible fix for this? I don't understand why this is not working :/ It works in studio but not in game...
ScreenGui > TextButton > LocalScript
LocalScript Below.
1 | Character = game.Players.LocalPlayer.Character |
2 | torso = Character.Torso |
3 |
4 | function onClicked(ScreenGui) |
5 | torso.CFrame = CFrame.new(Vector 3. new(- 131.7 , 9.3 , - 30.85 )) -- Coordinates |
6 | end |
7 |
8 | script.Parent.MouseButton 1 Click:Connect(onClicked) |
Make your variables local and use WaitForChild() on your Torso.
1 | local player = game.Players.LocalPlayer |
2 | local Character = player.Character or player.CharacterAdded:wait() |
3 | local torso = Character:WaitForChild( "Torso" ) |
4 | function onClicked() |
5 | torso.CFrame = CFrame.new(- 131.7 , 9.3 , - 30.85 ) -- Coordinates |
6 | end |
7 |
8 | script.Parent.MouseButton 1 Click:Connect(onClicked) |