Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Detecting a part's rotation?

Asked by 8 years ago
Edited 8 years ago

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
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)? TheDeadlyPanther 2460 — 8y
0
I know the parts are exactly that rotation (180, -0, -180). But it won't detect it. TheHospitalDev 1134 — 8y
0
Do you know how to use the debugger? Link150 1355 — 8y
0
Nope TheHospitalDev 1134 — 8y
View all comments (6 more)
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" GoldenPhysics 474 — 8y
0
Didn't work ;( TheHospitalDev 1134 — 8y
0
Hmm.. Let me think. What does it print and not print? TheDeadlyPanther 2460 — 8y
0
"Breh i ain't workin" TheHospitalDev 1134 — 8y
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. GoldenPhysics 474 — 8y
0
Ok. Could you invite me to a team create? My username is EmeraldSlash, TDP is an alt for SH. TheDeadlyPanther 2460 — 8y

Answer this question