Can someone help me?. My Shop script is not working. My cash wont decrease when i buy an item [closed]
My Cash is not decreasing when i buy an item
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | local Buy = player.PlayerGui:WaitForChild( "Gui" ).Main.Info.Buy |
03 | local leaderstats = player:FindFirstChild( "leaderstats" ) |
04 | local Cash = leaderstats:FindFirstChild( "Cash" ) |
05 | local price = player.PlayerGui:WaitForChild( "Gui" ).Main.Info.Price |
06 | local Gui = player.PlayerGui:WaitForChild( "Gui" ).Main.Frame |
07 | local Purchased 1 = Gui.Item 1. Purchased |
08 | local Purchased 2 = Gui.Item 2. Purchased |
09 | local Purchased 3 = Gui.Item 3. Purchased |
12 | Buy.MouseButton 1 Click:connect( function () |
14 | if Cash.Value > = price.Value then |
15 | Cash.Value = Cash.Value - price.Value |
16 | if price.Value = = 100 then |
17 | local oldGun = player.Backpack:FindFirstChildOfClass( "Tool" ) or player.Character:FindFirstChildOfClass( "Tool" ) |
19 | game.ReplicatedStorage.Tools.Pistol:Clone().Parent = player.Backpack |
22 | if price.Value = = 300 then |
23 | local oldGun = player.Backpack:FindFirstChildOfClass( "Tool" ) or player.Character:FindFirstChildOfClass( "Tool" ) |
25 | game.ReplicatedStorage.Tools.Revolver:Clone().Parent = player.Backpack |
28 | if price.Value = = 500 then |
29 | local oldGun = player.Backpack:FindFirstChildOfClass( "Tool" ) or player.Character:FindFirstChildOfClass( "Tool" ) |
31 | game.ReplicatedStorage.Tools.Uzi:Clone().Parent = player.Backpack |