so here I am, making a fire ball game and so there are different types of fire balls
when you press "F" the fire ball that you equipped will be shot
I had made a shop where you can buy different types of fireballs and basicly equip them with "bool Values"
so I made a bool value called "hasiceball" which is false and "hasfireball" which is also false.
so when I press the buy button which is the script below it will purchase the "ice fire ball" and by doing that it setts "hasiceball" to true and setts all other bool values to false like "hasfireball" would be set to false if true...
local items = game.Players.LocalPlayer:WaitForChild("FruitFolder") local bitems = game.Players.LocalPlayer:WaitForChild("BoughtFolder") local player = game:GetService("Players").LocalPlayer --local rep = game:GetService"ReplicatedStorage" --local tool = rep:FindFirstChild"HexSpitter" local amt = 800 local money = player.leaderstats.Cash script.Parent.MouseButton1Click:Connect(function() if bitems.Bhasiceball.Value == false and money.Value >= amt then money.Value = money.Value - amt items.hasiceball.Value = true items.haspoiball.Value = false items.hasspamball.Value = false items.hassniperball.Value = false items.hasfireball.Value = false items.hasregball.Value = false end end)
so when I tested I noticed that when I pressed buy for the "fireball" I got the FireBall but when I got back the ice ball I Had to Pay Again... so that's my problem
how do I make it so its a 1 time buy when you equip another fire ball and when a player leaves the game (I don't want it so you have to pay constantly!) ?
please help me.
Change your script to the following:
local items = game.Players.LocalPlayer:WaitForChild("FruitFolder") local bitems = game.Players.LocalPlayer:WaitForChild("BoughtFolder") local player = game:GetService("Players").LocalPlayer --local rep = game:GetService"ReplicatedStorage" --local tool = rep:FindFirstChild"HexSpitter" local amt = 800 local money = player.leaderstats.Cash script.Parent.MouseButton1Click:Connect(function() if bitems.Bhasiceball.Value == false and money.Value >= amt then money.Value = money.Value - amt items.hasiceball.Value = true end end)
To keep this a one-time purchase for eternity, you must do a data store. Click on the link to see how you would do that .
Update: I found another useful link.