I’m writing a program to move an instance to another point of the map. How it works is that it will get all the children from a folder and put it in a for i, v, in pairs(). Find the child that’s assigned to the player and matches the X, Y, and Z values. So the script works, the XYZ values match the child’s XYZ values. When I check to see this work with a print, I printed the tiles XYZ values. The X and Z had nothing wrong, but the Y that’s set to 0 did not print 0. Instead it printed 2.4318695068359e-05 and not 0. I think what the problem here is an architecture problem because I’ve come across this problem when I program in Java. The script below.
local player = game.Players.LocalPlayer
local Settlers = game.Workspace.Units.NonDangerous.Settler:GetChildren()
local Tiles = game.Workspace.Tiles:GetChildren()
script.Parent.Activated:Connect(function()
for i, Settler in pairs(Settlers) do
if Settler.PlayerName.Value == player.Name then
for i, tile in pairs(Tiles)do
if tile.XYZ.Value == Settler.XYZ.Value then
print("Works")
print(tile.Name)
print(StartTile.XYZ.Value)
print(StartTile.Position.Y)
end
end
end
end
end)