Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

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. Tkdriverx 514 — 8y
0
I'm using "Cash" value. In script it's invoke to leaderboard, which already exist. DevKarolus1 70 — 8y
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 .-. User#5978 25 — 8y
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. DevKarolus1 70 — 8y

1 answer

Log in to vote
0
Answered by
Tkdriverx 514 Moderation Voter
8 years ago

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)

Ad

Answer this question