Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Nothing happens ??? (simple script)

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!!

5 comments

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.

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!

1

On line 7 and 17 you must implement i into the code, else the CFrame will remain the same.

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.

0

Try reversing the direction of the CFrames position for when the touch ended event occured.

1 answer

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!

1 comment

This discussion is preserved as it was. New answers, comments, and votes are closed.