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: Elevator Script Bug

Previous Thread :: Next Thread 
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
01 Jul 2016 12:21 PM
local parent = script.Parent
local workspace = game.Workspace
local parts = {workspace.Button1, workspace.Button2, workspace.Button3, workspace.Elevator}

function onClicked(click)
local currentHeight = workspace.Elevator.Position.Y
local desiredHeight = 0--enter height you want to move to
local waitTime = 0.03--enter speed between each increment (0.03 minimum)
local moveIncrement = 0.1--enter studs moved per waitTime
local part = 1

parts[4]:WaitForChild("isMoving").Value = true

while desiredHeight ~= currentHeight and wait(waitTime) do
if desiredHeight < currentHeight then
repeat
parts[part].Position = parts[part].Position + Vector3.new(0, moveIncrement, 0)

if part < #parts + 1 then
part = part + 1
elseif part >= #parts + 1 then
part = 1
end
until part >= #parts
elseif desiredHeight > currentHeight then
repeat
parts[part].Position = parts[part].Position - Vector3.new(0, moveIncrement, 0)

if part < #parts + 1 then
part = part + 1
elseif part >= #parts + 1 then
part = 1
end
until part >= #parts
end
end

parts[4]:WaitForChild("isMoving").Value = false
end

parent.ClickDetector.MouseClick:connect(onClicked)

I tried this. The first three parts move further than the fourth one. Also, their position is about twenty, but instead of moving down, they're moving up. Please help.
Report Abuse
Kurokku is online. Kurokku
Joined: 01 Aug 2015
Total Posts: 3622
01 Jul 2016 12:23 PM
Why did you create another forum, post on the other one
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
01 Jul 2016 12:28 PM
Because I bumped four times over like a day, and nobody responded. That forum is long gone.
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
01 Jul 2016 01:30 PM
See? This is what happens. Bump.
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
01 Jul 2016 04:31 PM
b
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
01 Jul 2016 07:23 PM
Bump. If I don't get an answer soon, I'm reposting.. again.
Report Abuse
Kurokku is online. Kurokku
Joined: 01 Aug 2015
Total Posts: 3622
01 Jul 2016 08:17 PM
Maybe posting the errors that were given in the output box would help... You can't expect someone to find a small error in a long script
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
02 Jul 2016 10:50 AM
No errors.
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
06 Jul 2016 11:17 AM
b
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