The Topic: (Isolating the City-RPG part lol)
There are different teams (or “jobs”) that every player can instantly become, and each team has (or will have) its own range of income in Cash
.
Every so often, the server will check each of the 65 (at best) players if they’re actually in a “job” (eq. Doctor, Construction, Business). If a player is part of a legitimate job, the system can give a player a random sum of cash - example, math.random(11000,66000)
- as well as multiplying it a small amount if the player has a house.
The Actual Issue:
local CashIncome = coroutine.wrap(function()
while true do
wait(10) --debug time, will delay it for 60 - 120 seconds at best
for _,Player in pairs(game.Players:GetPlayers()) do
local CashAmount = math.random(11000,66000)
if Player.TeamColor == BrickColor.new("Institutional white") or BrickColor.new("Black") then --start of the issue
CashAmount = 0
-- return -- edit: never mind, halts the ENTIRE THING
end
if Player.Tags:FindFirstChild("HasHouse") then
CashAmount = CashAmount * (math.random(1125,1300)/1000) --1.125x to 1.3x multiplier, does this cause inflation lol
end
Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value + CashAmount
end
end
end)
CashIncome()
What was supposed to happen?
-
Let’s assume
Player
is part ofCashier
, an actual job (We’ll just pretend he doesn’t have a house lol). -
The system will then check if the player is NOT in a team that is coloured with
BrickColor.new("Institutional white")
orBrickColor.new("Black")
. -
The system is happy and gives the player a random sum, without the house part.
The actual results? (start of the issue)
- Same
PlayerWhoHasJob
as Cashier (without a house) - The system checks if the player is in a legitimate job.
-
The system thinks the player actually isn’t in a job and doesn’t give the player a random sum.
Followed by later “no-no”(s) from the system to the Player.
What else have I tried?
- Attempted to use the
Team
itself as a comparing variable toPlayer.Team
Result: no effect, no sum given - Attempted to use the
Team.Name
as a comparing variable toPlayer.Team
Result: no effect, no sum given - Last resort: attempted to find other topics related to different
IntValue.Value
increases to different teams in the span of approx. an hour.
Result: Nowhere near close that?? Be surprised if someone somehow found a similar topic cause I may have rushed it