while wait() do local player = game.Players.LocalPlayer script.Parent.Text = "Kills:" ..player:WaitForChild("leaderstats"):FindFirstChild("Kills").Value end
When using GUIs I recommend referencing the player directly, whether it's via game.Players.ViktorCorvinus or script.Parent.Parent.Parent.Parent,
Sincerely Yours, -ViktorCorvinus
LocalPlayer
is only valid when you're in a LocalScript, and LocalScripts only run in certain on the client (not the server), and only in certain locations (ex they don't run in ReplicatedStorage, most places in the Workspace, etc). This scripts works offline for you because when you test things in "Play" mode in Studio, your computer acts both as the server and the client. If you use "Test" mode (with a server and a Player), it will act the same as in online mode.
Your script is attempting to keep a TextLabel up to date Kills.Value. Some notes:
:FindFirstChild
if you aren't going to check if the value is nil
firstChanged
event on the 'kills' object:local player = game.Players.LocalPlayer local kills = player:WaitForChild("leaderstats"):WaitForChild("Kills") kills.Changed:Connect(function() script.Parent.Text = "Kills: " .. kills end)