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:
01 | function onClicked(playerWhoClicked) |
02 |
03 | local model = workspace.Tuner 1. Lift --Model to move |
04 | local part = model:GetChildren() [ 1 ] |
05 | model.PrimaryPart = part |
06 |
07 | for i = 1 , 1 ,. 01 do |
08 | wait(i) |
09 | model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() - Vector 3. new( 0 , 3 , 0 )) |
10 | end |
11 | end |
12 |
13 | 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.
01 | local model = workspace.Tuner 1. Lift --Model to move |
02 | local part,db = model:GetChildren() [ 1 ] , false |
03 | model.PrimaryPart = part |
04 |
05 | script.Parent.ClickDetector.MouseClick:connect( function () |
06 | if db = = false then |
07 | db = true |
08 | for i = 1 , 100 do |
09 | wait() |
10 | model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() - Vector 3. new( 0 ,. 03 , 0 )) |
11 | end |
12 | db = false |
13 | end |
14 | end ) |
01 | function onClicked(playerWhoClicked) |
02 |
03 | local model = workspace.Tuner 1. Lift --Model to move |
04 | local part = model:GetChildren() [ 1 ] |
05 | model.PrimaryPart = part |
06 |
07 | for i,v in pairs = 1 , 1 ,. 01 do |
08 | wait(i) |
09 | model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() - Vector 3. new( 0 , 3 , 0 )) |
10 | end |
11 | end |
12 |
13 | 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?