When you click Buy Plane it dosnt remove 200 money from the leaderstat Heres the code. theres more code thats just the part that not working

if game.Players.LocalPlayer.leaderstats.Money.Value >= 200 then

			----------What The Player Does when you buy it
			
			
			game.Players.LocalPlayer.leaderstats.Money.Value = game.Players.LocalPlayer.leaderstats.Money.Value - 200
			
			game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.ImageLabel.Visible = true
			game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.SpawnPlane.Visible = true
			
			
			
		end

This is the hole script if you wanna look at that

------------------OPEN

game.Players.LocalPlayer.PlayerGui.ShopGui.TextButton.MouseButton1Click:connect(function()

game.Players.LocalPlayer.PlayerGui.PS.Frame.Visible = true





----------------------WHAT HAPPENDS WHEN YOU BUY IT




if game.Players.LocalPlayer.PlayerGui.PS.Frame.Visible == true then
	
	
	game.Players.LocalPlayer.PlayerGui.PS.Frame.BuyPlane1.MouseButton1Click:connect(function()
		
		
		if game.Players.LocalPlayer.leaderstats.Money.Value >= 200 then
			
			
			
			----------What The Player Does when you buy it
			
			
			game.Players.LocalPlayer.leaderstats.Money.Value = game.Players.LocalPlayer.leaderstats.Money.Value - 200
			
			game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.ImageLabel.Visible = true
			game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.SpawnPlane.Visible = true
			
			
			
		end		
	end)		
end




--------------------CLOSE


if game.Players.LocalPlayer.PlayerGui.PS.Frame.Visible == true then
	
	
	game.Players.LocalPlayer.PlayerGui.PS.Frame.Close.MouseButton1Click:connect(function()
		
		game.Players.LocalPlayer.PlayerGui.PS.Frame.Visible = false

		
	end)
end

end)

3 comments

0

Does it work to make those GUI's visible?

0

When you click Buy it suppost to make 2 things visible and remove cash

0

You need some MouseButton1Down events. and better spacing