im trying to make chess, the board has alot of parts
the left and bottom sides of the board have a index value Like “C” or “5”
i wanna Find the location a square is for example A5 or C7
Im thinking of raycasting from each side of a square to the square next and raycast from that square to the next and repeat until it finds a index value; is this a good option or is there a better suitable method for this?
There are a few ways of doing this,
- You could use some math to do this where if a player picks C3, you get the bottom-left most corner and add 3 positions right (C) and 3 positions up.
- You can just name all the parts with the correct name place and do
BoardParts:FindFirstChild("C7")
, though naming will be a bit tedious - If you really want to use IndexValues than you can use a for loop and find the correct part with the correct IndexValue, though I would suggest you use attributes instead of values
for _,part in BoardParts:GetChildren() do
if part.IndexValue.Value == "C7" then
-- do something
end
end
2 Likes