I have a variable (X = game.Workspace:FindFirstChild("BottomCard")) but a "BottomCard" doesn't exist yet because later in the script I change "TopCard" to "BottomCard". Currently it gives me an error saying that X is nil, and if I use :WaitForChild() it just stops the script indefinitely because the part won't exist until later on in the script. What can I use that doesn't stop the script?
Hi
This should work:
local x = game.Workspace:WaitForChild("TopCard")
x.Name.Changed:Connect(function() x = game.Workspace:FindFirstChild("BottomCard") end)