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

It wont remove 200 cash from leaderstat?!

Asked by 8 years ago

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

Log in to vote
1
Answered by 8 years ago

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.

Ad

Answer this question