I’m finna feel damn stupid. It doesn’t even sound (and probably isn’t) hard, I just cant.
Also never used devforum so idk how to format stuff properly, sorry if its a mess.
I’ve been so stuck on figuring the furthest points of a part (so I can compare them to the Players position to check if they’re inside an area).
Heres what I got so far (hopefully it formatted properly?). This code has been edited to make a physical representation of what the limits are.
function getParameters(floor)
local x,x2,y,z,z2 = 0,0,0,0,0
x = floor.Position + Vector3.new((floor.Size.X/2),0,0)
x2 = floor.Position + Vector3.new(-(floor.Size.X/2),0,0)
z = floor.Position + Vector3.new(0,0,(floor.Size.Z/2))
z2 = floor.Position + Vector3.new(0,0,-(floor.Size.Z/2))
y = floor.Position.Y
return x,x2,y,z,z2
end
local fields = game.Workspace.DuellingFields
for i,v in pairs(fields:GetChildren()) do
local fx,fx2,fy,fz,fz2 = getParameters(v)
local p = Instance.new("Part", game.Workspace.Mess)
p.Position = fx
local p1 = Instance.new("Part", game.Workspace.Mess)
p1.Position = fx2
local p2 = Instance.new("Part", game.Workspace.Mess)
p2.Position = fz
local p3 = Instance.new("Part", game.Workspace.Mess)
p3.Position = fz2
end
When I run this, I get this:
Clearly, the position of the X and Z have flipped and I can’t figure out why.
If this was an obvious error and I’ve missed it I am so very sorry.
Oh cool you can do emojis here
p.s. if theres an easier way to do this I’d be very grateful if you could link the wiki page on it, many thanks
-bray