generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

(PAYING 200!) *Scripting help* Dm me

Previous Thread :: Next Thread 
Barmoi is online. Barmoi
Joined: 21 Jun 2011
Total Posts: 3797
02 Dec 2017 06:19 PM
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
Report Abuse
Aliics is not online. Aliics
Joined: 29 Sep 2014
Total Posts: 471
02 Dec 2017 07:05 PM
-- 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)
Report Abuse
Barmoi is online. Barmoi
Joined: 21 Jun 2011
Total Posts: 3797
02 Dec 2017 07:09 PM
The click detector does not work


ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
Report Abuse
Aliics is not online. Aliics
Joined: 29 Sep 2014
Total Posts: 471
02 Dec 2017 07:11 PM
-- I renamed the event to the variable
-- and I removed a parentheses.

detector = Instance.new("ClickDetector", telebrick);

detector.MouseClick:connect(function(_player)
Report Abuse
Barmoi is online. Barmoi
Joined: 21 Jun 2011
Total Posts: 3797
02 Dec 2017 07:13 PM
still


ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
Report Abuse
Aliics is not online. Aliics
Joined: 29 Sep 2014
Total Posts: 471
02 Dec 2017 07:20 PM
-- 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)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image