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

Trying to get certain parts in the player help?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

So I'm trying to get certain parts that are inside the character (part names are in a table) but I'm having problems getting it to work, The current state has no output. and only returns the 'else' part.

NormalParts = {"Slab","Wall","Plate"}
local event = script.BlockInsertation

event.OnServerEvent:connect(function(player, name)
local chil = game.Workspace[name]:GetChildren()
    for i, v in pairs (chil) do
        for n, m in pairs(NormalParts) do
        if NormalParts[n] == v.Name then
            local clone = workspace:FindFirstChild(name).Slab:Clone() or workspace:FindFirstChild(name).Wall:Clone() or workspace:FindFirstChild(name).Plate:Clone()
            clone.Parent = game.Workspace
            break
        else
        local con = script.Parent.MoneyDisplay.ClonedErrors:GetChildren()
            if #con < 1 then
                local cloneerror =  script.Parent.MoneyDisplay.ErrorDisplay:Clone()
                cloneerror.Parent = script.Parent.MoneyDisplay.ClonedErrors
                cloneerror.Description.Text = "Undefined part value"
                cloneerror:TweenPosition(UDim2.new(0.78, 0,0.92, 0),"In","Linear",.2,false)
                wait(1.5)
                cloneerror:TweenPosition(UDim2.new(0.78, 0,1.1, 0),"Out","Linear",.2,false)
                wait(1)
                cloneerror:Destroy()
                end
            end
        end
break
    end
end)

Answer this question