Issue with RemoteEvent Parameters

Hey all, I have a question regarding a piece of code that won’t work. This script is designed to remove old UI elements and pull a new one from ReplicatedStorage. However, whenever I call the RemoteEvent with the parameter from a normal script, I end up with attempt to call a nil value in the console from my LocalScript, even though that object exists. When I pass the parameter along as a normal variable inside the LocalScript, the function works like normal, and the result is expected.

Here is a snippet of code from the LocalScript and server script that aren’t working properly:

Script:

local ElementID = "game.ReplicatedStorage.ScreenElements.UI1"
...	
game:GetService("ReplicatedStorage").ScreenRequest:FireAllClients(ElementID) 

Local Script:

...
game.ReplicatedStorage.ScreenRequest.OnClientEvent:Connect(function(Called_Screen) 
	script.Parent:ClearAllChildren()
	Called_Screen:Clone().Parent = script.Parent
end)

Thanks! :slight_smile:

Maaybe instead of saying

local ElementID = "game.ReplicatedStorage.ScreenElements.UI1"

You can remove the quotations???

1 Like

Yep, that worked! I looked over in my own code while double-checking to see if I did any mistakes. Thank you! :smiley:

1 Like

Just to clarify, variables that have quotations/double-quotations in them ('/") will be defined as Strings and not Instances :upside_down_face:

2 Likes

Ah, that’s good to know. Thanks for the tip!

1 Like