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!