I keep getting the error "attempt to compare two userdata values" with this part of my script:
1 | for _,v in pairs (children) do |
2 | if v.Position > = game.Workspace.dud.Position then |
3 | v:Destroy() |
4 | end |
5 | end |
As soon as I change == to >= it comes up with that error. Please explain why and tell me how to fix it.
The problem here is that you cannot ask the program to check if a vector is bigger than the other, or a vector is smaller than the other.
Though a way to fix it would be to refer to each axis on its own.
So it would look something like this:
1 | for _,v in pairs (children) do |
2 | if v.Position.Y > = game.Workspace.dud.Position.Y then -- assuming you want to compare the y-axis |
3 | v:Destroy() |
4 | end |
5 | end |
Hope it helped!