I am trying to create a sword fighting game where there is a sword fighting arena. To enter the arena, you must click a part witch activates the teleport script. Here is what I have.
function onClicked()
local c = game.Players:GetChildren()
for i = 1, #c do
c[i].Character.Torso.CFrame = CFrame.new(script.Parent.Parent.Teleport.Position)
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
The only problem with this script, is that it teleports all players in the server, instead of just the player who clicked the part. I am very new to scripting, so if someone could just give me a script that has all the current things my current one does, but with only the specified player that clicked the part being teleported, that would be awesome!

2 comments
Don't give bad methods and deprecated code. Either teach good code or don't teach at all.
'Sorry that I made a mistake like most humans do, but no need to be rude about it.'