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 » Scripting Helpers
Home Search
 

Re: Sliding model?

Previous Thread :: Next Thread 
moazmoazmoaz is not online. moazmoazmoaz
Joined: 20 May 2011
Total Posts: 540
27 Mar 2014 08:23 AM
So is it possible for me to script a model to slide down? Right now I am trying to make a countdown where the numbers slide down in front of you then a big red 'GO' slides down so you start the sf. I was about to make it then I realised that models don't have a position problem. I figured out I can just make them appear and disappear but that is not that good and now I need to do it all over again. Also is there a way for me to set the time it takes it to slide from one place to another? Because I need it to be exactly one second

Thank you, moazmoazmoaz

Also if you know about any tutorials that teach this I might prefer that then just being given the script.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
27 Mar 2014 08:56 AM
So you mean you're using models to do the countdown?
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
27 Mar 2014 08:57 AM
Or it's just the 'GO' that's a model?
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
27 Mar 2014 09:10 AM
There's always :MoveTo() but that doesn't work so well. I actually made a function that sets the CFrame of each part in the model, and it works much better.

function moveModel(model, pos)
local centre = model:GetModelCFrame()
local offsets = {}
local children = model:GetChildren()
for i=1, #children do
if children[i]:IsA("BasePart") then
local rot = children[i].CFrame - children[i].Position
offsets[i] = children[i].CFrame.p - centre.p
children[i].CFrame = rot + pos + offsets[i]
end
end
end


Combine that with a for loops in another function, and you should be able to smoothly 'slide' a model.

function slideModelTo(model, targetVec, seconds)
local m = model
local time = seconds
local curPos = model:GetModelCFrame().p
for i=0, time ,1/30 do
local v = (targetVec - curPos) / time * i
moveModel(m,curPos+v)
wait()
end
end

slideModelTo(Workspace["Part"], Vector3.new(50,100,0), 5)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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