Hi.
What I am trying to do right now is that I want to match the Humanoid Root Part
's position with the table of values I have.
If the value is matched with table, then it will break the while true do
loop.
I don't think I can use generic for loop for this
because I have to check 3 things simultaneously.
So how would I go on to do this?
I tried doing GetChildren()
before hand but it gave me table error. I don't know how to do this. Please help me.
Here is my code if you do need it.
local TargetX = { 83, 84, 85, 86, 87, 88 } local TargetY = { 3 } local TargetZ = { -94, -95, -96, -97, -98 } while true do local XPos = HumanoidRootPart.Position.X local YPos = HumanoidRootPart.Position.Y local ZPos = HumanoidRootPart.Position.Z print(RoundNumber(XPos), RoundNumber(YPos), RoundNumber(ZPos)) wait() local XChild = TargetX:GetChildren() local YChild = TargetY:GetChildren() local ZChild = TargetZ:GetChildren() if RoundNumber(XPos) == XChild and RoundNumber(YPos) == YChild and RoundNumber(ZPos) == ZChild then print("Match Found") break end end
The RoundNumber
is my rounding function. There is nothing wrong with that btw.
local TargetX = { 83, 84, 85, 86, 87, 88 } local TargetY = { 3 } local TargetZ = { -94, -95, -96, -97, -98 } while true do local XPos = HumanoidRootPart.Position.X local YPos = HumanoidRootPart.Position.Y local ZPos = HumanoidRootPart.Position.Z print(RoundNumber(XPos), RoundNumber(YPos), RoundNumber(ZPos)) -- XPos+0.5:floor() works too wait() for _, x in pairs(TargetX) do for i, y in pairs(TargetY) do for m, z in pairs(TargetZ) do if x == (XPos+0.5:floor()) and y == (YPos+0.5:floor()) and z == (ZPos+0.5:floor()) then WillBreak = true add more ends end if WillBreak then break -- might have to move this idk too lazy to check. end