Greetings,
I am making a kind of passive income business mechanic for my game and the game does not take money from cash.value. My script is down below:
game.ReplicatedStorage.Businesses.Business1Bought.OnServerEvent:Connect(function(player, cash, folder, business1bought)
local cash = player:WaitForChild("leaderstats"):WaitForChild("Cash").Value
print("Business1 event succesfully received by script for player: " ..player.Name)
cash = cash - 50
print("Business1 owned by " ..player.Name.. " has started producing.")
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has produced 5$ worth of products.")
cash = cash + 5
wait(60)
print("Business1 owned by " ..player.Name.. " has expired")
local business1expired = game.ReplicatedStorage.Businesses.Business1Expired
business1expired:FireClient(player, cash, folder, business1expired)
end)
Please help, if you need the first script (the localscript) please tell me in the answer section. Thanks!