Got this with and without the .Magnitude
Players.PizzaArmy333.PlayerScripts.Hitbox:43: invalid argument #2 (Vector2 expected, got nil)
(sorry late response fire alarm went off)
Got this with and without the .Magnitude
Players.PizzaArmy333.PlayerScripts.Hitbox:43: invalid argument #2 (Vector2 expected, got nil)
(sorry late response fire alarm went off)
can you print before that what targetcords and currentCords are? (and maxMove)
Hmmmm…
I got this when running the print:
Players.PizzaArmy333.PlayerScripts.Hitbox:42: attempt to concatenate string with nil
print(targetCords.." "..currentCords)
MaxMove is (1,1)
you gotta do a comma
print(targetCords, currentCords)
added maxmove, heres what i got
3, 1 nil 1, 1
I found the issue from a related post someone sent
I think in your Code it would be this correction then:
if (targetCords.X <= maxMove.X) and (targetCords.Y <= maxMove.Y) and data.Owner.Value == game.Players.LocalPlayer.Name then
It’s printing the same thing, but the error is now gone.
I’m gonna fiddle with this and I’ll notify if I fix it
I made a slight mistake, please use the current code I edited.
The same thing is happening, it’s printing the target cords and max move correctly, but the current cords are nil for some reason
Yea, it’s probably you set something wrong.
But what? theres nothing setting it to nil and nothing is set to nil
Have you ever set the Attribute for the CurrentTile/Cords
CurrentTile is a value set to default of the square under it specifically, and the script is trying to get CurrentCords from an attribute in the CurrentTile
Like Value in an attribute or value like a num value?
currenttile is an object value
I havent made the part where it changes when it gets to its destination
So if I understand you correctly then this should help?
local currentCords = currentTile.Value
No, it would have to be
local currentCords = currentTile:GetAttribute("Cords")
Maybe you have misspelt Cords with something else
No, im absolutely stumped
the only thing that it could be is that it’s a localscript and its trying to access the server workspace, but it can also get the target cords easy
With what value does the Attribute be given to