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

Trying to name a part if it has a certain rotation?

Asked by 7 years ago

I've tried to make a script that detects whether or not a part is on a certain rotation, for example

A Vertical part
-179.998, 0, 90.002

A Horizontal part
-179.998, 0.002, -179.998

And my code

local model2 = workspace.FenceR:GetChildren()
local storageVertical = Instance.new("Folder",workspace.FenceR)
for i,v in pairs(model2) do
    if v.Name ~= "Folder" then
        print(v.Rotation.X..", "..v.Rotation.Y..", "..v.Rotation.Z)
        if (v.Rotation.X <= 181 and v.Rotation.X >= 175) and ((v.Rotation.Y <= 5 and v.Rotation.Y >= 0) and (v.Rotation.Z >= 85 and v.Rotation.Z <= 91)  then
            print("I work")
            v.Name = "Vertical"
            v.Parent = storageVertical
        else
            print("Breh i ain't workin") --Does not print
        end
    end
end

No output either

Answer this question