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

How do I make this teleport not global?

Asked by 7 years ago

It wasn't global before, but now since a few updates it makes everyone teleport when the button is pressed. I'm not sure what needs to change to accommodate the recent updates, and that only the player who had clicked it teleports.

Here is my script:

local Part = script.Parent.Parent.Teleport1stFloor6
local offset = 1
math.randomseed(tick())




function onClicked()
script.Beep2:Play()
 for count = 1,1  do 
  local counter = math.random(1)
  local counterr = math.random(1)
  local counterrr = math.random(1)
  print(counter)
  print(counterr)
  print(counterrr)
local c = game.Players:GetChildren() 
for i = 1, #c do 
c[i].Character.Torso.CFrame = CFrame.new(Part.Position + Vector3.new(counter, counterrr, counterr - 4))
  wait(1)
 end
end
end

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

Thank you so much!

1 answer

Log in to vote
0
Answered by
KenUSM 53
7 years ago

do

function onClicked(clicked)

and change local c = clicked -- the person who click it

or c = game.Players.LocalPlayer

0
I tried using both methods of calling c = , but I get the same error every time = attempt to get length of local 'c' (a userdata value) :( callmehbob 54 — 7y
Ad

Answer this question