Okay. In my game, you can shoot a "windball". When it hits this, it teleports them over to these coordinates. The only problem: It teleports all the players! Please tell me how to fix it. This is my script:
game.Players.PlayerAdded:connect(function(Player)
local player = Player.Name
script.Parent.Touched:connect(function(part)
if part.Name == "windball" then
local tp = workspace:findFirstChild(player)
tp:MoveTo(Vector3.new(245.8, 2, -205))
end
end)
end)
It does work, so don't say it doesn't.
WindBall script (LocalScript):
player = game.Players.LocalPlayer
char = player.Character
torso = char.Torso
mouse = player:GetMouse()
function press(key)
key = key:lower()
if key == "q" then
local Ball = Instance.new("Part")
Ball.Parent = workspace
Ball.Shape = "Ball"
Ball.Size = Vector3.new(5, 5, 5)
Ball.BrickColor = BrickColor.new("Institutional White")
Ball.Name = "windball"
Ball.Transparency = .4
Ball.TopSurface = 0
Ball.BottomSurface = 0
Ball.CFrame = torso.CFrame * CFrame.new(0,0.5,-5)
local Bv = Instance.new("BodyVelocity")
Bv.Parent = Ball
Bv.maxForce = Vector3.new(math.huge,math.huge,math.huge)
Bv.velocity = torso.CFrame.lookVector * 100
game.Debris:AddItem(Ball,4)
wait(3)
end
end
mouse.KeyDown:connect(press)
It gets put in the players backpack from another script.

3 comments
Well, that's because you made it teleport all players, because every player has the connection in it.
Do you just want one player to be teleported?
I've updated my answer.