I was taking a tycoon kit, making it slightly better, but I can't seem to get the stat value to work. Help?
EDIT: Added another check
owner = script.Parent.Parent.Parent.Parent.Owner.Value -- This is the tycoon owner, aka playername plrService = game:GetService('Players') player = plrService:WaitForChild(owner):FindFirstChild("Value") -- Checks players for the ownervalue if (player ~= nil) then money = player:WaitForChild('Money') if not money then print('No money') return end while wait(1) do print(player) if not player then script.Parent.Text = 'Money: 0' else script.Parent.Text = 'Money: '..money.Value end end end end
A better way to load the owner's stats would be to update it every time the owner's value is changed. You can do this using the Changed event of value:
local owner = script.Parent.Parent.Parent.Parent.Owner owner.Changed:connect(function(value) if value then local player = game.Players[value] if player then local value = player.Value local money = value.Money -- Code end end end)