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

How do I fix this script?

I am trying to teleport a player when they touch a part, but it isn't bringing any output, therefore, not letting me debug. Code :

local plyr = game.Players.LocalPlayer

function onTouched()
	script.Parent.Touched:connect(plyr).Torso.Position = Vector3.new(5.194, 3.37, 45.765)
end

2 answers

✓ Accepted answer

This is what you left out:

local plyr = game.Players.LocalPlayer

function onTouched()
    script.Parent.Touched:connect(plyr).Torso.Position = Vector3.new(5.194, 3.37, 45.765)
end

script.Parent.Touched:connect(onTouched)
local plyr = game.Players.LocalPlayer

 

function onTouched()

    script.Parent.Touched:connect(plyr).Torso.Position = Vector3.new(5.194, 3.37, 45.765)

end

 

script.Parent.Touched:connect(onTouched)

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