How would i go about accessing a players lighting through their humanoid ?
Im currently making a module script and i have the specific players humanoid as a parametre, i simply need to access the lighting through that humanoid parametre to clone a blur and color correction instance into their lighting (not into mine nor the server’s, only that specific player)
Im kind of stuck since im a bit confused on how i should do it, any idea’s ?
The start of this explanation really depends on where you’re activating this code. If it’s on your client and you’re trying to change someone else’s lighting, you should look for somewhere else to activate it since that’s exploitative. A simple solution would be to move that activation code to the server instead, and that way only the server can tell the other client to do the lighting changes.
If your activation code is already on the server, then great! You don’t have to worry about the first part. Now all you would have to do is fire a remote event from the server to the specific client, where that client would have the code to change their own lighting.
In short, the server would have the code to start the process of telling that specific client to change their lighting (Script), and the client would have their own code where it would make changes to its own lighting (Local Script).
One last tip: I would advise against using the humanoid as a reference point of the player, just use the player object itself instead.
Thanks for explaining!
The code runs on the client but it can be run on the server since its a module,
As for the remote, how would i fire it specifically to a certain person ?
Also, for the player object, do i simply have to use Humanoid.Parent or is it something else ?
For the remote event, just have the remote inside of Replicated Storage (so both the clients and the server can see it), and you can just call RemoteEvent:FireClient(player)
to send that signal to the player. You can find more about Remotes here.
If you want to get the player object from that humanoid, you can just use game.Players:GetPlayerFromCharacter(humanoid.Parent)
, but you should make sure that the humanoid’s parent exists (is not nil) if you don’t have that yet.
Alright i think i understand
My thought was to fire all clients and make a script that recieves it when fired, then pass on the character as a parametre and check if the local player matches, if so then i would just replicate the lighting, but your version seems more optimized
Thanks! c:
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.