Hello everyone, I have problem with money from outpost. When player capture outpost receive every 5 sec +10 money, but can't use in tycoon to buy something... Someone said i should use RemoteFunction, but idk how im still newbie in scripting.
Here is script which giving money(Maybe help some):
local paymentAmount = 10 local paymentPeriod = 5 local owner = script.Parent.CurrentOwner local neutral = script.Parent.NeutralColor local payoutVersion = 0 function StartPayingOut () if owner.Value == neutral.Value then payoutVersion = 0 return end payoutVersion = payoutVersion + 1 local curVersion = payoutVersion while curVersion == payoutVersion do for _, player in ipairs(game.Players:GetPlayers()) do if player.TeamColor == owner.Value and player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Cash") then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + paymentAmount end end wait(paymentPeriod) end end owner.Changed:connect(StartPayingOut)
Probably it's request, but i don't know how to make it work perfectly... I'm using berezaa tycoon kit and i already read some about RemoteFunction in Roblox wiki, but i don't understand...
The solution is simple:
Looking at berezaa's tycoon kit, he makes a Smoke object in ServerStorage that stores the money for each player. This is the value that needs to be changed, not the leaderstat. His script will change the leaderstat when this value changes. Here's the path to the stat:
game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)