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

teleport player to a located working fine in studio but not in roblox player anyone know what to do?

I have a teleport script inside of a regular script inside of a part. It works fine in studio but in the roblox player. Anyone know a solution?

script.Parent.Parent.touch1.Touched:Connect(function()
	local player = workspace:FindFirstChild(game.Players.LocalPlayer.Name)
	wait(.5)
	player.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(176.303, 1.5, -21.643))
end)

1 comment

0

is that in a local script or a server script? because LocalPlayer can only be used in local scripts

1 answer

✓ Accepted answer

You should get the character from the Touched argument if it’s in a normal script:

script.Parent.Parent.touch1.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("HumanoidRootPart") then
		wait(0.5)
		hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(176.303, 1.5, -21.643))
	end
end)

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