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

How can I make this door opening/closing animation faster?

Asked by 7 years ago
Edited by OldPalHappy 7 years ago
Chest = script.Parent
Lid = Chest.Lid
Lid.PrimaryPart = Lid.Hinge

increment = 96
debounce = false

function rotate(model, amount)
        for i=1, math.abs(amount/1.7) do
            model:SetPrimaryPartCFrame(model.Hinge.CFrame * CFrame.fromEulerAnglesXYZ(0,math.pi/amount,0))
            wait()
        end
end

function openChest()
    print("Clicked on handle.")

    if not debounce then
        debounce = true
        if Chest.Open.Value then
            rotate(Lid, increment)
        else
            rotate(Lid, -increment)
        end
        Chest.Open.Value = not Chest.Open.Value
        debounce = false
    else
    end
end

for i,v in pairs(Lid:GetChildren()) do
    if v.Name == "ClickSensor" then
        v.ClickEvent.OnServerEvent:connect(openChest)
    end
end

--This chest uses a script that makes ClickDetectors compatible with FilteringEnabled.

I'm unsure how to make the speed of the door opening faster

0
Change 1.7 to something else cabbler 1942 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Change 1.7 to something lower lol

Ad

Answer this question