Heres something I do for the game, I use the repeat until nil loop so that the script waits until it finds the requirements, let me show you an example;
repeat wait(0)until game and game:FindFirstChild("Workspace")
That'll repeat until the game loads, and Workspace loads, but I just use the 'Workspace' coding as a just-in-case, and for game.DescentdantAdded, you can use it for multiple purposes, for instance, to check what type it is, or what its name is, let me show you an example;
repeat wait(0)until game and game:FindFirstChild("Workspace")
game.DescentantAdded:connect(function(Object)
if Object:IsA("Part") then
print(Object.Name.." is a Part!")
end
end)
Now, if you want it to check the name, then;
repeat wait(0)until game and game:FindFirstChild("Workspace")
game.DescentantAdded:connect(function(Object)
if Object.Name == "Part" then
print("Its a Part!")
end
end)
As you'll see, the game.DescentantAdded is very useful for all sorts of things! It just depends on how you use it, and the repeat until nil loop will repeat waiting until the game loads, and Workspace loads. Hope this helped!
1 comment
Didn't work.