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

How do I make the script look for the local player instead of me? [SOLVED]

Asked by 5 years ago
Edited 5 years ago

I am making a script that activates night vision, and for the time being I had it set up for me so I could test it out. Now that I am done and finished, how do I make it so it looks for the local player instead of me?


script.Parent.MouseButton1Down:connect(function(click) if script.Parent.Parent.Parent.vision.Visible == true then game.Workspace.ReeseTP.Face.NVG5On.Light.Enabled = false elseif script.Parent.Parent.Parent.vision.Visible == false then game.Workspace.ReeseTP.Face.NVG5On.Light.Enabled = true end end)
0
"LocalPlayer" is a property of the "Players" service. All you need to do is get the "Players" service and access the LocalPlayer property. local players = game:GetService("Players"); local player = players.LocalPlayer. User#25115 0 — 5y
0
It's pretty straightforward. This needs to be a LocalScript for the LocalPlayer property to be accessible. Also, the ":GetService("service")" method of "game" is recommended, especially on the client. User#25115 0 — 5y
0
Thanks Phlegethon! ReeseTP 7 — 5y
0
No problem! Be sure to put [Solved] in your title so people know that you don't need help anymore. User#25115 0 — 5y

Answer this question