I have this powerup, which needs to open a big door. But the door needs to go slow, but how do i make it go slower without changing the time (wait 8) between the frames?
HERE IS THE SCRIPT:
inuse = false recharge = 1
function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") ~= nil) and (inuse == false) and (hit.Parent:findFirstChild("Powerup") ~= nil) then if (hit.Parent.Powerup:findFirstChild("Heavy") ~= nil) then --checks if player is heavy inuse = true for i=1,14 do wait(8) script.Parent.Button.CFrame = script.Parent.Button.CFrame - Vector3.new(0, 0.05, 0) script.Parent.Door.CFrame = script.Parent.Door.CFrame - Vector3.new(0, -15, 0) --open door end wait(recharge - 0.35) for i=1,14 do wait(0.25) script.Parent.Button.CFrame = script.Parent.Button.CFrame + Vector3.new(0, 0.05, 0) script.Parent.Door.CFrame = script.Parent.Door.CFrame + Vector3.new(0, -15, 0) --close door end inuse = false end end end
script.Parent.Button.Touched:connect(onTouched)
if you could help I would apperciate it.
I've recently Discovered the TweenService, which is useful for stuff like that. Unsure if it works properly for CFrame, but it's worked wonders on GUI.
http://wiki.roblox.com/index.php?title=API:Class/TweenService
Try this out. If you can Tween from one CFrame to the other, it should be completely smooth. Again haven't tried it but works in concept.