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

door wont work normal how make it work less edgy?

Asked by 4 years ago

in youtube tutorials you can find how make door and model with same things in model but in youtube door rotating same in real but door model that i download is moving very edgy

local Can = true
local Open = false

script.Parent.Event.OnServerEvent:connect(function(Player)
    local Mag = (script.Parent.Center.Position-Player.Character.HumanoidRootPart.Position).magnitude
    if Mag <= script.Parent.Range.Value then
        if Can then
            Can = false
            if Open == false then
                local finish = script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)
                for i = 0,1,.1 do
                    local cfm = script.Parent.PrimaryPart.CFrame:lerp(finish,i)
                    script.Parent:SetPrimaryPartCFrame(cfm)
                    wait()
                end
                Open = true
            else
                Open = false
                local finish = script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)
                for i = 0,1,.1 do
                    local cfm = script.Parent.PrimaryPart.CFrame:lerp(finish,i)
                    script.Parent:SetPrimaryPartCFrame(cfm)
                    wait()
                end
            end
            Can = true
        end
    end
end)

Answer this question