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

upgrades saving when dying and make the upgrades you have already inactive and invisible?

Asked by 9 years ago

Hi I was scripting this script and I was wonder how to make it when you buy the upgrade for the sword it saves when you die and when you leave? Also when you die the upgrades you bought already they go inactive and invisible. Can you help?

price = 550
plr = game.Players.LocalPlayer
debounce = false
script.Parent.MouseButton1Click:connect(function()
   if debounce then return end 
    local v = plr.leaderstats.Credits
    debounce = true 
    if v.Value >= price then
        plr.Backpack.ClassicSword.Configurations.LungeDamage.Value = 50
        v.Value = v.Value - price
        script.Parent.Parent.Buy.Visible = true
        wait(0.2) 

        for i = 0.1,1,0.1 do
            wait(0.1)
            script.Parent.Parent.Buy.TextTransparency = i
        end

        script.Parent.Active = false
        script.Parent.Visible = false
        script.Parent.Parent.upgrade2.Active = true
        script.Parent.Parent.upgrade2.Visible = true
        script.Parent.Parent.error.Position = UDim2.new(0, 200, 0, 100)
        script.Parent.Parent.Buy.Position = UDim2.new(0, 200, 0, 100)

        print('You bought the item!')
    else 
    print ('Cant buy item!')
        script.Parent.Parent.error.Visible = true

        for i = 0.1,1,0.1 do 
            wait(0.1)
            script.Parent.Parent.error.TextTransparency = i
        end
    end
debounce = false
end)

Answer this question