Ad
Log in to vote
0

My Tools Break after being cloned what's causing this?

Asked by 20 days ago

I set up a basic shop system so you can buy guns off a terrible looking menu. but for some reason when the gun is cloned all the scripts break any idea what the problem is?

Script:

local weapon = game.Workspace.C7A2
local plr = game.Players.LocalPlayer
local sus = plr:WaitForChild("leaderstats")
local creds = sus:WaitForChild("Credits")
local CredsAmount = 250
local meanie = script.Parent["Half Life Scientist Fear: No I dont Want to Die!"]
local nice = script.Parent.Money

script.Parent.MouseButton1Down:Connect(function()

    if creds.Value >= CredsAmount then
        local Dupelicate = weapon:Clone()
        creds.Value = creds.Value - CredsAmount 
        Dupelicate.Parent = plr.Backpack
        script.Parent.Parent.Parent.Enabled = false
        nice:Play()
    end
    if creds.Value <= CredsAmount then 
        script.Parent.Text = "bruh get your poor ah outta hereee"
        wait(2)
        script.Parent.Text = "Buy C7A2 250$"

        if math.random(1, 6) == 1 then
            meanie:Play()
        end
    end

end)

Answer this question