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
 

Roof that slides/moves to a side.

Previous Thread :: Next Thread 
MostBeast234 is not online. MostBeast234
Joined: 01 Jun 2014
Total Posts: 1071
15 Jun 2016 07:20 PM
I'm not a great scripter, but does anyone know how to make a roof move/slide to a side by clicking a button. I want to make a stadium & with a roof that can be opened and closed. If you don't know what I mean you can search it up.
Report Abuse
iDerpyDogez is not online. iDerpyDogez
Joined: 05 Feb 2012
Total Posts: 1781
15 Jun 2016 07:44 PM
:lerp()


#code while true do end
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
15 Jun 2016 07:45 PM
Something like this?

local roof = script.Parent

local startPosition = roof.Position;
local rot = roof.CFrame - root.Position;
local targetPosition = startPosition + Vector3.new(100, 0, 0); -- You can mess with that value. 0,0,0 will get you no movement, 100, 0, 0 is 100 studs on the x-axis, etc.
local speed = 5;

local dir = 0;

local function Open() dir = 1; end
local function Close() dir = -1; end

local duration = (targetPosition-startPosition).magnitude/speed
local t = 0;
while (true) do
local dt = wait();
t = t + dir*dt/duration; -- pretty sure that's right
if (t < 0) then
t = 0;
end
if (t > 1) then
t = 1;
end
roof.CFrame = rot + startPosition:Lerp(targetPosition, t);
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