Hello!
I'm trying to pass an object from a normal script to a localscript which I wasn't able to do since I'm not sure how to get the sent object with the localscript. I looked at this developer link about remote functions and events, but it was very unclear to me, and I wasn't able to find out how.
eventName:FireAllClients(script) -- should send the script object
Now for the localscript:
eventName.OnClientEvent:Connect(functionName) -- when the event is fired, it connects to the function, but how do I receive the script object from this localscript?
Hello, 7z99! The problem with passing objects with FireClient()
is that they might not be rendered yet (StreamingEnabled) or that the object isn't accessable with LocalScripts
. For example, you cannot fire a script through with FireClient()
. You also can't fire things in ServerStorage
or ServerScriptService
as they are only accessible to the server. For more information go to the Server-Client Model on the Roblox Developer Hub. Make sure to accept this answer if it hepls you.
I ended up solving it.
Normal Script:
eventName:FireAllClients(script)
LocalScript:
eventName.OnClientEvent:Connect(functionName) function(argument1) -- brackets are where the arguments go --pretend this does stuff lol end