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

trying to unanchor random parts?

Asked by 3 years ago

local numberOfPartsToDelete = 5000 local Map = script.Parent

local function has_value (tab, val) for index, value in ipairs(tab) do if value == val then return true end end

return false

end

game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(raw_msg) local msg = raw_msg:lower()

    if msg == "delete" then

        local randomNumbers = {}

        for i = 1, numberOfPartsToDelete do
            table.insert(randomNumbers, math.random(1, #Map:GetChildren()))
        end

        for i,v in pairs(Map:GetChildren()) do
            if v:IsA("Model") or v:IsA("BasePart") then
                if has_value(randomNumbers, i) then
                    v.anchored = false
                end
            end
        end
    end
end)

end)

0
local numberOfPartsToDelete = 5000 local Map = script.Parent local function has_value (tab, val) for index, value in ipairs(tab) do if value == val then return true end end return false end game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(raw_msg) local msg = raw_msg:lower() if msg == "delete" then local randomNumbers = {} for i meowcat_hi 0 — 3y

Answer this question