I'm trying to make a Model slowly move down for 3 seconds. Thank's to whoever helped me on the first question, but I just need it to slowly move down for 3 seconds, but I have to keep clicking it and it moves like 2 studs down:
function onClicked(playerWhoClicked) local model = workspace.Tuner1.Lift --Model to move local part = model:GetChildren()[1] model.PrimaryPart = part for i = 1,1,.01 do wait(i) model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() - Vector3.new(0,3,0)) end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Please do not double post.
The problem is that you didn't have a debounce to your script, as well as the fact that you were waiting i seconds before re-iterating.. if you do that then the script will wait a lot more than it should before subtracting CFrames again.
local model = workspace.Tuner1.Lift --Model to move local part,db = model:GetChildren()[1],false model.PrimaryPart = part script.Parent.ClickDetector.MouseClick:connect(function() if db == false then db = true for i = 1,100 do wait() model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() - Vector3.new(0,.03,0)) end db = false end end)
function onClicked(playerWhoClicked) local model = workspace.Tuner1.Lift --Model to move local part = model:GetChildren()[1] model.PrimaryPart = part for i,v in pairs = 1,1,.01 do wait(i) model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() - Vector3.new(0,3,0)) end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Marked as Duplicate by Goulstem, Redbullusa, and EzraNehemiah_TF2
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?