Hi! I’m using cframe to move sets during this show, it’ll work fine going upwards but when they return back ‘down’ it’ll begin to twitch/break. I’ve tried adjusting the script but I have no idea what is causing this?
It can be seen in this video:
Ignore the bad recording but it going up works perfectly fine, the issue is going back ‘down’ this can be seen in the video hopefully.
Script used to make it raise back down:
local Parent = script.Parent
local Finish = script.Parent.ProjectionsOFF.CFrame
for i = 0,1,.005 do
local CFrameMath = Parent.CModel.PrimaryPart.CFrame:lerp(Finish,i)
Parent.CModel:SetPrimaryPartCFrame(CFrameMath)
wait()
end
1 Like
Could you send the whole script? What it looks like is happening is the code to move it up is still running while the code to move it down is going. Also, could you take a look on the server to see what is happening?
Sure!
The script to go up looks like this:
-- destact
local Parent = script.Parent
local Finish = Parent.A.CFrame
for i = 0,1,.005 do --to change "speed" change the last variable
local CFrameMath = Parent.CModel.PrimaryPart.CFrame:lerp(Finish,i)
Parent.CModel:SetPrimaryPartCFrame(CFrameMath)
wait()
script.Disabled = true
end
How are the two pieces of code positioned? Are they one right after the other? Also, is this code running on the client or the server? If it’s running on the client, that might explain what is happening.
They’re currently in separate scripts, it’ll also show the same on the server.
That’s probably the problem then. If they aren’t in a line the code probably will not wait for the code above to finish (unless you used events or something)
1 Like
Ah, would disabling then waiting a second or so not do the same?