Is it possible to have two local scripts, located within a player model, that are able to check for values between one another? For instance, a player has a "MainPlayer" localscript and a "Weapon" localscript. I want the Weapon localscript to check for a child under the "MainPlayer" localscript (not a function or anything, just a RemoteEvent that MainPlayer is the parent of), is this possible?
Here's my attempt at trying:
local MainPlayer = script.Parent.Parent.Parent:WaitForChild("MainPlayer") local Guarding = MainPlayer:WaitForChild("Guarding")
From a ServerScript within a LocalScript that is a child of a Tool, I'm trying to get this script to wait for a RemoteEvent named "Guarding" that is located under another LocalScript under the Player, which is the Parent of the tool.
Hello, Saevitiae!
Short answer: Yes. And your code should work.
Longer answer:
You need to be careful with how that script was created/moved. If it was done by the client, then most likely the server doesn't know its there. If it was done by the server, then the client 100% knows its there.
Useful links:
If this answers your question, please mark it as the accepted answer.