Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with LocalPlayer please?

Asked by
Nidoxs 190
8 years ago

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

Log in to vote
1
Answered by 8 years ago

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.

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. dyler3 1510 — 8y
Ad
Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
8 years ago

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

0
Nothing. Nidoxs 190 — 8y
0
Post both of your complete scripts dyler3 1510 — 8y
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.) Nidoxs 190 — 8y
0
Lol, ok. Sorry I couldn't fix the problem for you. dyler3 1510 — 8y
View all comments (3 more)
0
It's fine! :) Nidoxs 190 — 8y
0
nevermind i MADE IT WORK! :D Nidoxs 190 — 8y
0
Oh, well thats good. What'd you have to do? dyler3 1510 — 8y

Answer this question