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

Clicked parts dosent work?

Asked by 3 years ago

I am trying to make a buying system or something. The problem - once i press the button it works only once. the first press of the button prints First part and Second part which means that the script works

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    print("First part")
    local cash = player.leaderstats.Cash
    local playergui = player.PlayerGui.Inventory.MainSlot.Slot1

    if playergui.Itemname.Value == "" then 
        print("Second part")
    end
end)

But once i click next time it prints that it dosent work or that slot if full but once i check the slot it empty so i come to this conclusion that my scipt for some reason dosent work here is the full script.

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    print("First part")
    local cash = player.leaderstats.Cash
    local playergui = player.PlayerGui.Inventory.MainSlot.Slot1

    if playergui.Itemname.Value == "" then 
        print("Second part")
        player.PlayerGui.Inventory.MainSlot.Slot1.Itemname.Value = "Intel UHD Graphics 630"-- in other script make it empty once i sell it so its not the problem
        cash.Value = cash.Value - 100
        player.PlayerGui.Inventory.MainSlot.Slot1.Space.Value = true 
    else
        print("Dosent work or maybe inventory full")
    end
end)

And thats all for helping me.

Answer this question