This script works perfectly in studio put in-game, it doesn't do anything. Please help.
plr = game.Players.shasta mouse = plr:GetMouse() mouse.KeyDown:connect(function(key) if key == "t" then if plr ~= nil then local pos = plr.Character.Torso.Position plr:LoadCharacter() plr.Character.Torso.CFrame = CFrame.new(pos) end end end)
Hopefully, you are using a localscript. You should make a variable defining the character since when a player joins, their character is initially set to nil. Also, idk if you want localPlayer or specifically you.
plr = game.Players.LocalPlayer mouse = plr:GetMouse() char = plr.Character or plr.CharacterAdded:wair() mouse.KeyDown:connect(function(key) if key == "t" then if plr ~= nil then local pos = char:WaitForChild("Torso").Position plr:LoadCharacter() char.Torso.CFrame = CFrame.new(pos) end end end)
Although, I am not certain if this will work since you are loading the character and then setting the CFrame of the torso. The PlayerGui is cleared upon player respawn so this script might be removed. In the future, use UIS to handle keyboard input and such