Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I fix this script?

Asked by 9 years ago

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 :

1local plyr = game.Players.LocalPlayer
2 
3function onTouched()
4    script.Parent.Touched:connect(plyr).Torso.Position = Vector3.new(5.194, 3.37, 45.765)
5end

2 answers

Log in to vote
3
Answered by 9 years ago

This is what you left out:

1local plyr = game.Players.LocalPlayer
2 
3function onTouched()
4    script.Parent.Touched:connect(plyr).Torso.Position = Vector3.new(5.194, 3.37, 45.765)
5end
6 
7script.Parent.Touched:connect(onTouched)
Ad
Log in to vote
2
Answered by 9 years ago
01local plyr = game.Players.LocalPlayer
02 
03 
04 
05function onTouched()
06 
07    script.Parent.Touched:connect(plyr).Torso.Position = Vector3.new(5.194, 3.37, 45.765)
08 
09end
10 
11 
12 
13script.Parent.Touched:connect(onTouched)

Answer this question