Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

It wont remove 200 cash from leaderstat?!

Theres only chance when i click buy plane it will remove 200 cash. Sometimes it removes 200 and adds 200 at the same time. How Do i fix this

All i need this to do is remove 200 cash from the leaderstat. Ive watched almost all the tutorials on youtube and they dont help

the part i need help with is on line 5

if game.Players.LocalPlayer.PlayerGui.PS.Frame.Visible == true then
	
	game.Players.LocalPlayer.PlayerGui.PS.Frame.BuyPlane1.MouseButton1Down: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)

1 answer

well, on open, you use mousebutton1down, while on close you use mousebutton1click.

Um, why?

Make both clicks instead of down.

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

Hope this helped.

This discussion is preserved as it was. New answers, comments, and votes are closed.