Not sure why it's saying that, or what a userdata value is. I tried researching, but nothing had my answer. What am I doing wrong here?
Thanks to royaltoe, this question was solved! Thank you!
You're comparing a vector3 with another vector3 which you can't do.
what you can do is get the magnitude of the hit box and the vector3
magnitude = (hitbox.position- vector3.new(vector3 position goes here)).magnitude
and see if the magnitude is positive (the hitbox position is greater than the vector3() you specified or if it's negative, (less than the position specified)
while true do --Make helicopter go forward until it reaches the end of the map local startX = script.Parent.CFrame.X for i = startX , 97, 0.1 do yPos = script.Parent.Y zPos = script.Parent.Z script.Parent:SetPrimaryPartCFrame(i, yPos,zPos) wait(0.005) end script.Parent.hitbox.Orientation = Vector3.new(0, 0, 0) --Make the helicopter go back to the start of the map startX = script.Parent.CFrame.X for i = startX , -97, -0.1 do yPos = script.Parent.Y zPos = script.Parent.Z script.Parent:SetPrimaryPartCFrame(i, yPos,zPos) wait(0.005) end script.Parent.hitbox.Orientation = Vector3.new(0, 180, 0) wait(0.05) end
while true do --Make helicopter go forward until it reaches the end of the map local xPos = script.Parent.CFrame.X while(xPos < 97)do xPos = xPos + 1 yPos = script.Parent.Y zPos = script.Parent.Z script.Parent:SetPrimaryPartCFrame(CFrame.new(xPos, yPos,zPos)) wait(0.005) end script.Parent.hitbox.Orientation = Vector3.new(0, 0, 0) --Make the helicopter go back to the start of the map local xPos = script.Parent.CFrame.X while(xPos > -97)do xPos = xPos - 1 yPos = script.Parent.Y zPos = script.Parent.Z script.Parent:SetPrimaryPartCFrame(CFrame.new(xPos, yPos,zPos)) wait(0.005) end script.Parent.hitbox.Orientation = Vector3.new(0, 180, 0) wait(0.05) end