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

What is wrong about this script?

part = script.parent.parent.Part

script.Parent.Touched:connect(function()
	
	part.position = Vector3.new(25.55, 1.6, -57.6)
		wait(.05)
	part.position = Vector3.new(25.55, 1.8, -57.6)
		wait(.05)
	part.position = Vector3.new(25.55, 2.0, -57.6)
		wait(.05)
			
end)

Whenever you hit the part with the script in it, it is supposed to move. That's not working;. Nothing happens when it is touched.

1 answer

✓ Accepted answer

Remember, Lua is case sensitive. This means that upper and lower cases must be correct.

part = script.Parent.Parent.Part --.Parent is capital

script.Parent.Touched:connect(function()

    part.Position = Vector3.new(25.55, 1.6, -57.6) --Position is capital.
        wait(.05)
    part.Position = Vector3.new(25.55, 1.8, -57.6)
        wait(.05)
    part.Position = Vector3.new(25.55, 2.0, -57.6)
        wait(.05)

end)

However, i would also recommend using a for loop and adding 0.2 to the brick's Position every time.

part = script.Parent.Parent.Part --.Parent is capital

script.Parent.Touched:connect(function()
	for i = 1,3 do
		part.Position = part.Position + Vector3.new(0,0.2,0)
	end
end)

2 comments

0

I usually do everything capital and stuff. I have fever today, so my head is hurting so badly it is hard to think.

0

Also, I didn't know how to do loops. Thanks!

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