I'm trying to make life easy for myself (believe it or not) and make a script that detects if a part is vertical or horizontal. But it does literally nothing.

local model2 = workspace.FenceR:GetChildren()
local storageVertical = Instance.new("Folder",workspace.FenceR)
for i,v in pairs(model2) do
	if v.Name ~= "Folder" then
		if v.Rotation == Vector3.new(180, -0, -180) then
			v.Name = "Vertical"
			v.Parent = storageVertical
		end
	end
end

I've added a print to it, and it can't detect it. It will print.

local model2 = workspace.FenceR:GetChildren()
local storageVertical = Instance.new("Folder",workspace.FenceR)
for i,v in pairs(model2) do
	if v.Name ~= "Folder" then
		if v.Rotation == Vector3.new(180, -0, -180) then
			v.Name = "Vertical"
			v.Parent = storageVertical
		else
			print("Breh i ain't workin")
		end
	end
end

10 comments

0

So what is wrong with it? Are you trying to loosely detect it (meaning it will accept it as vertical if it's close, but not exactly, 180)?

0

I know the parts are exactly that rotation (180, -0, -180). But it won't detect it.

0

Do you know how to use the debugger?

0

Nope

0

Have you tried comparing the three axis seperately? Like "if v.Rotation.X == 180 and v.Rotation.Y == 0 and v.Rotation.Z = -180 then"

0

Didn't work ;(

0

Hmm.. Let me think. What does it print and not print?

0

"Breh i ain't workin"

0

Ok. Let's try a lot of printing. Where you have you're current print, also print v.Rotation, each individual axis (v.Rotation.X, etc.) and the line you're logic on line five. You should get a bunch of true and false printed.

0

Ok. Could you invite me to a team create? My username is EmeraldSlash, TDP is an alt for SH.