of     1   

Barmoi
#228354529Sunday, December 03, 2017 12:19 AM GMT

need help with a 2 player teleportation script. So if 2 people click a part they both teleport somewhere. I only made a script for one person, Can someone help me make it for 2 players? Script: local telebrick = script.Parent local position = Vector3.new(0,50,0) --replace the coordinates with the actual destination coordinates local Detector = Instance.new("ClickDetector") Detector.Parent = telebrick telebrick.ClickDetector.MouseClick:connect(function(plr) plr.Character.HumanoidRootPart.CFrame = CFrame.new(position) end) ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
Aliics
#228356474Sunday, December 03, 2017 1:05 AM GMT

-- I wrote this right now -- It may not be the best and it may not even work -- But it should :) players = {}; telebrick = script.Parent; position = Vector3.new(0, 50, 0); detector = Instance.new("ClickDetector", telebrick); telebrick.ClickDectector.MouseClick:connect(function(_player)) if (players[1] == nil or players[2] == nil) then local _choose = players[1] == nil and 1 or 2; players[choose] = _player; if (choose == 2) then players[1].Character.HumanoidRootPart.CFrame = CFrame.new(position); players[2].Character.HumanoidRootPart.CFrame = CFrame.new(position); players[] = {}; end else players[] = {}; end end)
Barmoi
#228356641Sunday, December 03, 2017 1:09 AM GMT

The click detector does not work ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
Aliics
#228356721Sunday, December 03, 2017 1:11 AM GMT

-- I renamed the event to the variable -- and I removed a parentheses. detector = Instance.new("ClickDetector", telebrick); detector.MouseClick:connect(function(_player)
Barmoi
#228356811Sunday, December 03, 2017 1:13 AM GMT

still ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
Aliics
#228357115Sunday, December 03, 2017 1:20 AM GMT

-- Decided to hop into studio and get that working for you -- It is tested and working, sorry it took so long for me to get back to you :) players = {}; telebrick = script.Parent; position = Vector3.new(0, 50, 0); detector = Instance.new("ClickDetector", telebrick); detector.MouseClick:connect(function(_player) if (players[1] == nil or players[2] == nil) then if (players[1] == _player) then return; end local _choose = players[1] == nil and 1 or 2; players[_choose] = _player; if (_choose == 2) then players[1].Character.HumanoidRootPart.CFrame = CFrame.new(position); players[2].Character.HumanoidRootPart.CFrame = CFrame.new(position); players = {}; end else players = {}; end end)

    of     1