Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make this teleport not global?

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

do

function onClicked(clicked)

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

or c = game.Players.LocalPlayer

1 comment

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) :(

This discussion is preserved as it was. New answers, comments, and votes are closed.