Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Solved] How would I fix this teleport player gui??

place = CFrame.new(1,1,1)
script.Parent.MouseButton1Down:connect(function()
local humanoid = game.Players.LocalPlayer:FindFirstChild("Humanoid")
if (humanoid ~= nil) then 
	humanoid.Torso.CFrame = place 
	end
	end)

When you click the parent it teleports the player who clicked anybody know?? [The script above doesn't work]

2 answers

✓ Accepted answer

Instead of

local humanoid = game.Players.LocalPlayer:FindFirstChild("Humanoid")
if (humanoid ~= nil) then
	   humanoid.Torso.CFrame = place
	end
end)

type:

local char = gme.Players.LocalPlayer.Character
if char then
	char.HumanoidRootPart.CFrame = place
end

You can't get the torso from the humanoid, but you can get it through the character like this:

R6:

place = CFrame.new(1,1,1)
script.Parent.MouseButton1Down:connect(function()
	local player = game.Players.LocalPlayer
	local char = player.CharacterAdded:wait()

	if (char~= nil) then
		char.Torso.CFrame = place 
	end
end)

R15:

place = CFrame.new(1,1,1)
script.Parent.MouseButton1Down:connect(function()
	local player = game.Players.LocalPlayer
	local char = player.CharacterAdded:wait()

	if (char~= nil) then
		char.LowerTorso.CFrame = place 
	end
end)

3 comments

0

Thanks but I tried it and.. It din't work for some reason

0

Errors?

0

Use the proper script for your game type

This discussion is preserved as it was. New answers, comments, and votes are closed.