Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why i can't use money from outpost in tycoon?

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...

4 comments

0

The tycoon is probably not using the same leaderstat value, it may be using "Money" or some other name. Change it to "Cash" if it's not already.

0

I'm using "Cash" value. In script it's invoke to leaderboard, which already exist.

0

Dude, don't put dev infront of your name if you use freemodels it makes you a noob because clearly you can't script .-.

0

Free models? In my game i created everything -.- so shut up... Im beginner in scripting ;s If you don't want to help please stop writing comments like this one.. If i need help then im writing here, if you don't know what is for this site.

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.