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
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