Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a transition go smoother?

Asked by 6 years ago

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.

0
use codeblock Cmonlol135 5 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question