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

How do I make this script correct and not incorrect?

Asked by 3 years ago
Edited 3 years ago

So whenever it reaches a certain amount, it doesnt break like it is soupossed to.

EX: It thinks 76 isnt less than 80 and 76 isnt greater than 80

All it does is NOT doing what it needs

(also it only reaches 1 and 2, doesnt pass to 3)

Code:

for i,v in pairs(workspace.Map:GetChildren()) do
            print('1')
            if v:IsA('Part') or v:IsA('WedgePart') or v:IsA('UnionOperation') or    v:IsA('CornerWedgePart') then
                print('2')
                if tonumber(v.Name) <= i and v:FindFirstChild('BodyVelocity') == nil then -- < MAIN PROBLEM
                    print('3')
                    v:BreakJoints()
                    local BV = Instance.new('BodyVelocity',v)
                    BV.MaxForce = Vector3.new(0,0,9e+20)
                    BV.Velocity = Vector3.new(0,0,-20)
                end
            end
        end

Answer this question