I've been working on a tycoon and I needed a money giver kinda as a reward so once you bought let's say a bench for your tycoon a money giver would pop up with it giving you money once then disappear. So I attempted making one and it worked but when I left the tycoon and joined the money giver came back and the game is supposed to save is there anything I can add to the scripts to make the money only work once and it remembers that here are the scripts.
deb = false
script.Parent.Touched:connect(function(part)
if game.Players:FindFirstChild(part.Parent.Name) then
if deb == false then
deb = true
local plr = game.ServerStorage.PlayerMoney:FindFirstChild(part.Parent.Name)
script.Parent.BrickColor = BrickColor.new("Bright red")
plr.Value = plr.Value + script.Parent.Parent.Amount.Value
wait(script.Parent.Parent.TimeToWait.Value)
deb = false
script.Parent.BrickColor = BrickColor.new("Bright green")
script.Parent:Remove()
end
end
end)
enabled = 0
val = 0
function onTouched(part)
-- All characters have a Humanoid object
-- If the model has one, it is a character
-- print("In The Script")
local h = part.Parent:findFirstChild("Humanoid") -- Find Humanoids in whatever touched this
if (h ~=nil) then -- If there is a Humanoid then
-- h.Health = h.MaxHealth -- Set the health to maximum (full healing)
if (enabled == 0) then
enabled = 1
wait(0.5)
script.Parent.Transparency = 1
script.Parent.CanCollide = false
script.Parent:Remove()
end
end
end
script.Parent.Touched:connect(onTouched) -- Make it call onTouched when touched

4 comments
btw sorry for my messy english im tired
lol its ok thanks for the help but i would have no idea how to do that
search online on how to do datastores, AlvinBlox is a great guy for that
https://youtu.be/DkYupSBUpes heres the vid