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: Simplex Elevator

Previous Thread :: Next Thread 
Caedus01013 is not online. Caedus01013
Joined: 22 Sep 2011
Total Posts: 279
16 Sep 2016 08:13 PM
I am trying to create an elevator where when a player touches the floor of the elevator then they get added to a table. Then any player's characters inside the elevator go up with the elevator. But when two players are in the elevator only one person goes up and the other stays at the bottom. Can anyone tell me what I have done wrong? Here is my script:


local names={}

script.Parent.Floor.Touched:connect(function(hit)
local plr=game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
if not names[plr.Name] then
names[plr.Name]=true
end
end
end)



debounce=true

script.Parent.ElevatorControl.ClickDetector.mouseClick:connect(function()
for k,v in pairs(game.Players:GetChildren()) do
if names[v.Name] and debounce then
script.Parent.Door1.Transparency=0.5
script.Parent.Door1.CanCollide=true
script.Parent.Door2.Transparency=0.5
script.Parent.Door2.CanCollide=true
local i=1
while wait() do
if i>=3 then
print(i)
script.Parent.Door1.Transparency=100
script.Parent.Door1.CanCollide=false
script.Parent.Door2.Transparency=100
script.Parent.Door2.CanCollide=false
break
end
v.Character.Torso.CFrame=v.Character.Torso.CFrame+Vector3.new(0,i,0)
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame+Vector3.new(0,i,0))
i=i+0.1
end
debounce=false
end
end
end)





script.Parent.ElevatorControl2.ClickDetector.mouseClick:connect(function()
for x,z in pairs(game.Players:GetChildren()) do
if names[z.Name] and not debounce then
script.Parent.Door1.Transparency=0.5
script.Parent.Door1.CanCollide=true
script.Parent.Door2.Transparency=0.5
script.Parent.Door2.CanCollide=true
local i=1
while wait() do
print(i)
if i>=3 then
script.Parent.Door1.Transparency=100
script.Parent.Door1.CanCollide=false
script.Parent.Door2.Transparency=100
script.Parent.Door2.CanCollide=false
break
end
z.Character.Torso.CFrame=z.Character.Torso.CFrame-Vector3.new(0,i,0)
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame-Vector3.new(0,i,0))
i=i+0.1
end
debounce=true
end
end
end)
Report Abuse
Caedus01013 is not online. Caedus01013
Joined: 22 Sep 2011
Total Posts: 279
16 Sep 2016 08:22 PM
bump
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
16 Sep 2016 08:25 PM
You have your waits inside the loop that check for the player.
Report Abuse
Caedus01013 is not online. Caedus01013
Joined: 22 Sep 2011
Total Posts: 279
16 Sep 2016 08:44 PM
Should I use a coroutine?
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