local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local auraGui = ReplicatedStorage:WaitForChild("AuraGUI")
local auraIncreaser = ReplicatedStorage:WaitForChild("AuraIncreaser")
local auraDecreaser = ReplicatedStorage:WaitForChild("AuraDecreaser")
local auraResetter = ReplicatedStorage:WaitForChild("AuraResetter")
local x3Multi = ReplicatedStorage:WaitForChild("x3Multi")
local cashIncrease = 150
local playerMultiplier = {}
local auraGuis = {}
Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local Aura = Instance.new("NumberValue")
Aura.Name = "Aura"
Aura.Value = 0
Aura.Parent = leaderstats
local Cash = Instance.new("NumberValue")
Cash.Name = "Cash"
Cash.Value = 0
Cash.Parent = leaderstats
playerMultiplier[plr] = 1
plr.CharacterAdded:Connect(function(char)
local head = char:WaitForChild("Head")
local gui = auraGui:Clone()
gui.Parent = head
gui.StudsOffsetWorldSpace = Vector3.new(0,2,0)
gui.AuraText.Text = Aura.Value
auraGuis[plr] = gui
end)
end)
local function updateAura(plr)
local gui = auraGuis[plr]
if gui then
gui.AuraText.Text = plr.leaderstats.Aura.Value
end
end
auraIncreaser.OnServerEvent:Connect(function(plr)
local auraGain = math.random(1000,5000)
plr.leaderstats.Aura.Value += auraGain
local mult = playerMultiplier[plr] or 1
local cashAmount = cashIncrease * mult
plr.leaderstats.Cash.Value += cashAmount
updateAura(plr)
end)
auraDecreaser.OnServerEvent:Connect(function(plr)
local auraLoss = math.random(1000,5000)
plr.leaderstats.Aura.Value = math.max(0, plr.leaderstats.Aura.Value - auraLoss)
updateAura(plr)
end)
auraResetter.OnServerEvent:Connect(function(plr)
plr.leaderstats.Aura.Value = 0
updateAura(plr)
end)
x3Multi.OnServerEvent:Connect(function(plr, amount)
playerMultiplier[plr] = amount
end)
#whys cash breaking
1 messages · Page 1 of 1 (latest)
Long story short I want the player to have a passive income of $150 when outside the safe zone, and a $450 if inside of the x3 multiplier area, however it gives everything correctly and just completely fumbles when a plr enters the x3 zone, just completely breaking the cash and even when exiting the user doesn’t get money again.
use zoneplus
also dont send amount thru x3multi its exploitable
tf is zoneplus?
have a the zone handling is a module and then have a seperate script for cash check if the player is in the safe zone using tags or booleans
a really good and popular module for handling zones like this
aight ill try figure it out thanks and yeah its using tags