#tool breaks when cloned into players backpack

5 messages · Page 1 of 1 (latest)

tardy coral
#

basically i have a broom and if you pick it up it will clone into your backpack. everything works, but when you try to use the broom it doesn't play the animation. i believe its the way the animation is set up and it probably has to be "starterpack" instead of cloning into the backpack but idk. any help? (i can send the script if you need)

tardy coral
tardy coral
#

@rancid light sorry for late reply but here

local m6d
local tool = script.Parent
local player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
local char = player.Character

local ts = game:GetService("TweenService")
local rep = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")

local cleanArea
local cleanPart
local cleanUpdate = rep.OtherEvents.CleanIn

local sound = tool.Sound

local sweepingAnimation = char:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Animation)

local canSweep = true

--// ANIMATIONS \\--

tool.Equipped:Connect(function()
    local sweepingAnimation = char:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Animation)
    
    local a:Weld = char:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
    m6d = Instance.new("Motor6D")
    m6d.Parent = char:FindFirstChild("Right Arm")
    m6d.Name = "RightGrip"
    m6d.Part0 = a.Part0
    m6d.Part1 = a.Part1
    m6d.C0 = a.C0
    m6d.C1 = a.C1
    a:Destroy()
    
    cleanPart = workspace:FindFirstChild("CleanUpModel")
    
    if cleanPart then
        for i, v in pairs(cleanPart:GetChildren()) do
            if v:IsA("UnionOperation") and v.Transparency ~= 1 then
                cleanPart:FindFirstChild("CleanUpPart").BillboardGui.Main.Visible = true
            end
        end
    end
    
end)

tool.Activated:Connect(function()
    
    if canSweep == true then
        
        canSweep = false
        sweepingAnimation:Play()
        sound:Play()
        
        wait(3.71)
        
        canSweep = true
        sweepingAnimation:Stop()
        sound:Stop()
        
    end
end)

tool.Unequipped:Connect(function()
    sweepingAnimation:Stop()
    m6d:Destroy()
    
    if sound.Playing == true then
        sound:Stop()
    end
    
    cleanPart = workspace:FindFirstChild("CleanUpModel")
    
    if cleanPart then
        cleanPart:FindFirstChild("CleanUpPart").BillboardGui.Main.Visible = false
    end
    
end)``` this is the animate script in the tool (the rest of the script is used for cleaning which isnt related)

```lua
local rep = game:GetService("ReplicatedStorage")
local tool = rep.Assets.Tools.Broom
local model = game.Workspace.BroomExampleLOL

local plr = game.Players.LocalPlayer

game:GetService("ReplicatedStorage").OtherEvents.ToolEvents.BroomPickUp.OnClientEvent:Connect(function()
    local d = tool:Clone()

    if plr.Backpack:FindFirstChild("Broom") then
        d:Destroy()
        plr.Backpack:FindFirstChild("Broom"):Destroy()

        for _, v in pairs(model:GetChildren()) do
            if v.Transparency < 1 then
                v.Transparency = 0
            end
        end

    else
        d.Parent = plr.Backpack
        game.SoundService.SFX.Pickup.TimePosition = 0.2
        game.SoundService.SFX.Pickup:Play()

        for _, v in pairs(model:GetChildren()) do
            if v.Transparency < 1 then
                v.Transparency = 0.6
            end
        end

    end

end)``` heres the script to duplicate