How can I make the CFrame Angles not.. glitchy?
Hi, I've tried to make a "Surface Blast Doors", but my script everytimes make the doors open BUT not open. I use CFrame Lerp and it makes that like the doors are open and not moving, but for roblox it moves, it moves only like a 0.001 stud and I don't know how to fix it. Please help. There is my script.
04 | script.Parent.ClickDetector.MouseClick:Connect( function () |
05 | warn( "Checking if SBD's are open.." ) |
07 | warn( "SBD's closed, checking if in move!" ) |
09 | warn( "SBD's not moving. Opening SBD's!" ) |
11 | local finish = script.Parent.Parent.PrimaryPart.CFrame*CFrame.Angles( 0 ,math.rad( 90 ), 0 ) |
13 | local cfm = script.Parent.Parent.PrimaryPart.CFrame:Lerp(finish,i) |
14 | script.Parent.Parent:SetPrimaryPartCFrame(cfm) |
18 | warn( "\nSBD's SUCCESSFULLY OPENED!" ) |
21 | warn( "\nPrepared to close!" ) |
23 | elseif open = = true then |
24 | warn( "SBD's opened, checking if in move!" ) |
26 | warn( "SBD's not moving. Closing SBD's!" ) |
28 | local finish = script.Parent.Parent.PrimaryPart.CFrame*CFrame.Angles( 0 ,-math.rad( 90 ), 0 ) |
30 | local cfm = script.Parent.Parent.PrimaryPart.CFrame:Lerp(finish,i) |
31 | script.Parent.Parent:SetPrimaryPartCFrame(cfm) |
35 | warn( "\nSBD's SUCCESSFULLY CLOSED!" ) |
38 | warn( "\nPrepared to open!" ) |
(The doors itself are the ClickDetector, I made that just for testing.)