Why is this not working

Make it so when somebody toches a part that it then teleports them to the position I put in the script

The script I have does not work

image

image

image

1 Like
  1. Do you have any errors?
  2. Make it “HumanoidRootPart”, not Torso.
2 Likes

Try this:

script.Parent.Touched:Connect(function(Hit)
	local Character = Hit.Parent
	if Character:FindFirstChild("Humanoid") then
		local CF = CFrame.new(-191.164, 4.125, 229.963)
		Character:SetPrimaryPartCFrame(CF)
	end
end)

R15 has no torso.

1 Like

Adding on, I think the if statement is likely part of the problem, checking it now.

Yeah, so just checked, I tried to use torso, and it doesn’t work, change it to HumanoidRootPart. Everything else is good.

local function OnTouched(hit)
	print("Teleport")
	local human = hit.Parent:FindFirstChild("Torso")
	if human then
		human.CFrame = CFrame.new(Vector3.new(0,0,0)) --Input coordinates here.
	end
end

script.Parent.Touched:Connect(OnTouched)