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

Help with LocalPlayer please?

So I have a script with about 1000 lines but I want to get the player(localplayer) it wont work in a normal script and when I put it into a localscript the entire script wont work! Is there a way to fix this or to get the player another way.

game.Players.LocalPlayer.PlayerGui.Notify.Text.Visible = true

2 answers

I don't have the whole script to look at, but I speculate that you put the LocalScript in the wrong place. LocalScripts can only work if they are in a player's Backpack, character model or PlayerGui.

1 comment

0

Also, there are certain functions or events limited to either Local or Server-side scripts, which may have been the problem. But this is true as well.

This is actually a pretty simple fix. Just follow along with what I tell you, and it should work perfectly fine at the end.


• Ok so first, put a LocalScript with the same parent as the other script (Make sure the other one is a regular script)

• Next, create an ObjectValue with the same parent, and name it PlayerObject.

• Lastly, you need to put in your scripts. Put this into the LocalScript:

script.Parent.PlayerObject.Value=game.Players.LocalPlayer
script:remove() --Optional Line

After you've done that, take out the part with the LocalPlayer on your other script, and set the Player to this:

repeat wait() until script.Parent.ObjectValue.Value
Player=script.Parent.ObjectValue.Value

Now, if you've done everything correctly, I believe your script should work right.


Anyways, I hope I helped. If you have any further questions/problems, please leave a comment below, and I'll see what I can do :P

7 comments

0

Nothing.

0

Post both of your complete scripts

0

Ugh! Nevermind. I'll disband the idea I had. Thanks for the help. (I'm not having you looking through 1000 lines my friend.)

0

Lol, ok. Sorry I couldn't fix the problem for you.

0

It's fine! :)

0

nevermind i MADE IT WORK! :D

0

Oh, well thats good. What'd you have to do?

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