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

Nothing happens ??? (simple script)

Asked by 7 years ago
p = script.Parent
script.Parent.Touched:connect(function(part)

for i = 1,6, 0.01 do
wait(.001)

p.CFrame = p.CFrame * CFrame.new(0,.01,0)
end




script.Parent.TouchEnded:connect(function(part)
for i = 1,6, 0.01 do
wait(.001)

p.CFrame = p.CFrame * CFrame.new(0,.01,0)
end
end)


Nothing fires and nothing is in output, please help!!

1
How will the script show output if you're not including any output to write to the dev console? Use print ("") to start debugging. Impacthills 223 — 7y
1
It's useless for you to seek help here if no information about what you're trying to achieve is provided. Please explain what the algorithm above does (what's its purpose) and what it should do! kazeks123 195 — 7y
1
On line 7 and 17 you must implement i into the code, else the CFrame will remain the same. nanaluk01 247 — 7y
0
its supposed to Cframe a block down 5 studs when touched, and when the player leaves the block it cframes back up 5 studs. SyndicateHalo 40 — 7y
0
Try reversing the direction of the CFrames position for when the touch ended event occured. Impacthills 223 — 7y

1 answer

Log in to vote
-1
Answered by 7 years ago
Edited 7 years ago

This is simply because the way you set the for loop won't run. For example, if someone says you need to run 1 mile today and you already ran 16 miles today, you won't need do anything. To fix this, we can set the third parameter like

for time = 10, 1, -1 --[[defaults to 1, but we want it to count down]] do
    print(time)
    wait(1)
end

Now all you need to do is implement this into your code since I don't know what you really want with the loops.

Hope this helps!

0
Ad

Answer this question