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

Teleporter ain't working ?

It just doesn't work lol, i don't know why i'm stuck on it 20 minutes ;-;

function teleportPlayer(pos, torso)
local char = torso
char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))

script.Parent.Touched:connect(function(part)
	teleportPlayer(Vector3.new(-31,2,95), part.Parent.Torso)
end)
end

1 answer

✓ Accepted answer

Your function is not ran so your event will not trigger.

The problem:-

function teleportPlayer(pos, torso)
	local char = torso
	char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))
	
	script.Parent.Touched:connect(function(part)
	    teleportPlayer(Vector3.new(-31,2,95), part.Parent.Torso)
	end)
end -- you close the function here

The fix:-

function teleportPlayer(pos, torso)
	local char = torso
	char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))
end -- close the function here

script.Parent.Touched:connect(function(part)
    teleportPlayer(Vector3.new(-31,2,95), part.Parent.Torso)
end)

Hope this helps

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