I have leaderstats in local player and I have made sure that my cash value is named the exact name I have tried many things but it still says that leader stats is not a member of blueturtle8908 (me). I checked that the value is still there and it is so I don't know.
It is a local script if that makes a difference
Any ways, here is my code.
while true do local cash = game.Players.LocalPlayer.leaderstats cash.Cash.Value = Cash.Value - 40 script.Parent.Bill.Visible = true wait(5) script.Parent.Bill.Visible = false wait(60) end
It doesn't work since your trying to edit a server object with a local script. What you should do is inside a server script inside of ServerScriptService do this
local interval = 10 -- Change to how often you want to show the bill while true do for i,v in pairs(game.Players:GetChildren()) do local cash = v.leaderstats.Cash cash.Value = cash.Value - 40 game.ReplicatedStorage.ShowBill:FireClient(v) end wait(interval) end
Then you want to insert a RemoteEvent inside of ReplicatedStorage and name it "ShowBill" Once you do that with a local script inside of the ScreenGui with your bill insert this script
local dissapearTime = 5 -- How long you want the bill to show for game.ReplicatedStorage.ShowBill.OnClientEvent:Connect(function() script.Parent.Enabled = true wait(dissapearTime) script.Parent.Enabled = false end)
And that should be it.