The script is just to show how much money the player has. Not sure if it could cause lag or not. It works fine i just want to know if there is a better way to do it.
wait()
local bigcheese69800 = false
cashvalue = game.Players.LocalPlayer.leaderstats.Cash
repeat
wait(0.1)
script.Parent.Text = ("$").. cashvalue.Value
until bigcheese69800 == true
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("Leaderstats")
local Cash = leaderstats:WaitForChild("Cash")
local text = script.Parent
local function Update()
text.Text = "$"..Cash.Value
end
Update() -- run when the code starts
Cash.Changed:Connect(Update) -- updates when the cash value changes
yes, there is a better way of doing it.
if u wanna use runservice u can
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("Leaderstats")
local Cash = leaderstats:WaitForChild("Cash")
local text = script.Parent
local RunService = game:GetService("RunService")
local function Update()
text.Text = "$"..Cash.Value
end
RunService.RenderStepped:Connect(Update)