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

How do I check the parts Rotation then remove it?

I'm trying to make a wheel where it spins and then right after it's done spinning the script checks the Parts Rotation and if it's between 10-20 it removes that part.

if script.Parent.Rotation == Vector3.new(0, (10-20), 0) then
	script.Parent:Remove()
end

1 answer

✓ Accepted answer

Hi! You made a small mistake. Where it states in your Vector value, (10-20). The script looks at that as a Math problem sort of. The computer is reading it as this:

if script.Parent.Rotation == Vector3.new(0, -10, 0) then
script.Parent:remove()
end

To make it "between" two numbers in a simple way you would use the Greater Than(>) or Less Than(<) Operators. Your script SHOULD look like this:

if script.Parent.Rotation.Y>=10 and script.Parent.Rotation.Y<=20 then
    script.Parent:Remove()
end

Look at example two for some help on understanding.

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