Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

LocalPlayer is depreciated, what do I use now?

Hi!

I'm new to all of this and was using youtube tutorials to build my game. I got up to a rough working draft and published it to ROBLOX. It didn't work, at all.

The problem I have come to discover is that ROBLOX's servers don't like the word "LocalPlayer" anymore.

What I am trying to do is create a GUI for the player but a lot of my code looks like this:

game.Players.LocalPlayer.Character.Humanoid.MaxHealth = (game.Players.LocalPlayer.leaderstats.Level.Value * 15) + 100

How should I rewrite this code?

Thanks in advance

1 comment

1

A server does not know what a "LocalPlayer" is only a local script which runs on the clients device knows what a "LocalPlayer" is since the is only one player.

1 answer

✓ Accepted answer

Just like king said in the comments, is it a script or a local script? GUIs should be local scripts. So if it is a script change it to a local script and it should work.

This discussion is preserved as it was. New answers, comments, and votes are closed.