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

My click teleport teleports everyone?

Asked by 5 years ago
Edited 5 years ago

So I added a part where it would check which player clicks it but that hasn't any effect

function onClicked()

local c = game.Players:GetChildren() -- I think its here where it goes wrong
for i = 1, #c do 
c[i].Character.Torso.CFrame = CFrame.new(script.Parent.Parent.TP99.Position)--Name of object where u get tpd to
end 

end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)

function onClicked(player) -- but I added this so it would tp the person who clicks it but it still teleports all
    player.Character.Torso.CFrame = CFrame.new(script.Parent.Parent.TP99.Position)
end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)


0
The first function loops through the c table(which is a table of all players in the game) and teleports everyone in that table. Remove that function. The second function looks to work Thetacah 712 — 5y
0
use game.Players:GetPlayers() yHasteeD 1819 — 5y

1 answer

Log in to vote
-2
Answered by 5 years ago
Edited 5 years ago

Replace * local c = game.Players:GetChildren() -- I think its here where it goes wrong *With **local c = game.Players:GetChild() -- I think its here where it goes wrong **

0
oh lmao really? 3dwardIsBack -10 — 5y
0
I have it another way at this moment and it works too but will do it that way then, thanks 3dwardIsBack -10 — 5y
Ad

Answer this question