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

Dropped Items cant be picked up?

Asked by 5 years ago

hi i currently am able to pick up my models which are weapons and then use them in my inventory. when i implement the script below the guns/weapons drop out of the inventory but i am having some problems. - Cant pick up the weapons - weapons are in the air. - i have a gui to pick up the weapons and this doesnt show either.

this is the code im using.

function Death()
    wait(0.2)
    local Tool = script.Parent:FindFirstChildWhichIsA("Tool")
    if Tool then
        local M = script.Contain:Clone()
        M.Parent = game.Workspace
        M.Disabled = false
        if Tool:FindFirstChild("Handle") and script.Parent:FindFirstChildWhichIsA("Part") then
            Tool.Handle.Position = script.Parent:FindFirstChildWhichIsA("Part").Position
            Tool.Handle.Velocity = Vector3.new(0,0,0)
            Tool.Handle.RotVelocity = Vector3.new(0,0,0)
            Tool.Handle.CanCollide = true
            Tool.Parent = M
        end
    end
    local Player = game.Players:GetPlayerFromCharacter(script.Parent)
    if Player then
        local Value = 0
        local M = script.Contain:Clone()
        M.Parent = game.Workspace
        M.Disabled = false
        while true do
            local C = Player.Backpack:GetChildren()
            if #C <= 0 or (script.Configuration.DropAll.Value == false and Value >= script.Configuration.DropLimit.Value) then
                break
            end
            for i = 1,#C do
                if math.random(1,100) == 100 then
                    if C[i]:FindFirstChild("Handle") and Player.Character:FindFirstChildWhichIsA("Part") then
                        C[i].Handle.Position = Player.Character:FindFirstChildWhichIsA("Part").Position
                        C[i].Handle.Velocity = Vector3.new(0,0,0)
                        C[i].Handle.RotVelocity = Vector3.new(0,0,0)
                        C[i].Handle.CanCollide = true
                        C[i].Parent = M
                    end
                    Value = Value + 1
                end
                if script.Configuration.DropAll.Value == false and Value >= script.Configuration.DropLimit.Value then
                    break
                end
            end
        end
    end
end
script.Parent.Humanoid.Died:connect(Death)

thanks for any help

Answer this question