I'm looking for a function/roblox function that will check if an instance is a descendant of an instance with a classname "x".
I have created the function as such however I do not know if this is the best way for the system...
Confirmation or an alternative would be great.
-- This function assumes that the user deems the Instance's class as irrelevant
local function DescendantOfInstanceWithClass(Instance,Classname)
repeat
wait()
Instance = Instance.Parent
if Instance:IsA(Classname) then
return true
end
until Instance.Parent = game
return false
end

1 comment
Ahhhhhhhhhh this is exactly what i was looking for i thought there was something wrong with me... it's way too late i guess ahaha thanks for the great answer!