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
 

Re: *HELP* Please

Previous Thread :: Next Thread 
Barmoi is online. Barmoi
Joined: 21 Jun 2011
Total Posts: 3797
02 Dec 2017 05:43 PM
I 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
Barmoi is online. Barmoi
Joined: 21 Jun 2011
Total Posts: 3797
02 Dec 2017 05:49 PM
?


ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
Report Abuse
V_PN is not online. V_PN
Joined: 08 May 2011
Total Posts: 121
02 Dec 2017 05:55 PM
I'd something like add two string values and then use them to depend on if two players have clicked it.

Then it'd save the persons name (when the button is clicked) in the first value SPECIFICALLY, and to prevent it from overwriting in the next step make sure the value isnt
nil or something.

Then if the first value isn't nil then it'd go to the second one where it would store it,
then after that get the two players and teleport them to their location.

After that replace the values back to nil.

Might work, might not.



#code print('0')
Report Abuse
LuaCymru is not online. LuaCymru
Joined: 22 Jan 2015
Total Posts: 394
02 Dec 2017 06:21 PM
local telebrick = script.Parent
local position = Vector3.new(0,50,0) --replace the coordinates with the actual destination coordinates
local Detector = Instance.new("ClickDetector")
local bool = Instance.new('BoolValue',telebrick)
bool.Value =0
other = ''
Detector.Parent = telebrick

telebrick.ClickDetector.MouseClick:connect(function(plr)
if bool.Value == false then
other = plr.Name
bool.Value = true
else
if game.Players:FindFirstChild(other) then
plr2 = game.Players:FindFirstChild(other)
plr1 = plr
plr1.Character:MoveTo(position)
plr2.Character:MoveTo(position)
bool.Value = false
other = ''
else
other = plr.Name
bool.Value = true
end
end
end)
Report Abuse
LuaCymru is not online. LuaCymru
Joined: 22 Jan 2015
Total Posts: 394
02 Dec 2017 06:22 PM
local telebrick = script.Parent
local position = Vector3.new(0,50,0) --replace the coordinates with the actual destination coordinates
local Detector = Instance.new("ClickDetector")
local bool = Instance.new('BoolValue',telebrick)
bool.Value =false
other = ''
Detector.Parent = telebrick

telebrick.ClickDetector.MouseClick:connect(function(plr)
if bool.Value == false then
other = plr.Name
bool.Value = true
else
if game.Players:FindFirstChild(other) then
plr2 = game.Players:FindFirstChild(other)
plr1 = plr
plr1.Character:MoveTo(position)
plr2.Character:MoveTo(position)
bool.Value = false
other = ''
else
other = plr.Name
bool.Value = true
end
end
end)
Report Abuse
Barmoi is online. Barmoi
Joined: 21 Jun 2011
Total Posts: 3797
02 Dec 2017 06:24 PM
Thats script can fire if the same person clicks it twice



ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
Report Abuse
V_PN is not online. V_PN
Joined: 08 May 2011
Total Posts: 121
02 Dec 2017 06:26 PM
Then do something like the second value isn't the same as one. ez


#code while true do end
Report Abuse
Barmoi is online. Barmoi
Joined: 21 Jun 2011
Total Posts: 3797
02 Dec 2017 06:39 PM
how?


ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
Report Abuse
Barmoi is online. Barmoi
Joined: 21 Jun 2011
Total Posts: 3797
02 Dec 2017 06:51 PM
DSFSF


ʰᵉʸ ʷʰᵒ ᵐᵃᵈᵉ ᵐʸ ᵏᵉʸᵇᵒᵃʳᵈ ᵗᶦⁿʸ|R$99,788|~Rocks Owner & Lead VC'er|+2.3k posts
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