This is a local script.

So I have this simple script that changes the text of a textlabel (script.Parent.Frame.HP) to the value which is located at game.ServerStorage.PlayerStats(player's name).HP.Value

This value is a number.

local player = game.Players.LocalPlayer

while true do
	wait(.5)
	script.Parent.Frame.HP.Text = game.ServerStorage.PlayerStats:FindFirstChild(player.Name).HP.Value
end

For some reason, the script only works in testing mode (F5) where it spawns a character, but it doesn't work on the actual game.

4 comments

0

line 5 was too big to fit on the page, so it's spread out on two lines. It's not like this on the script.

0

Local script can't access ServerStorage in online mode for security reasons.

0

Oh, thanks.

0

I've changed it to lighting. Works well now, thanks!