Crrustyy
(boblox_man)
#1
Howdy,
I am using this lil script where it checks if an object is a ClickDetector:
local click = weap:GetDescendants()
if click:IsA("ClickDetector") then
However, I keep getting this error message:
ServerScriptService.Click:5: attempt to call a nil value
I thought it was an error with the GetDescendants() part, although changing it did nothing. Any suggestions?
:GetDescendants() returns a table, which is not an instance. What you probably meant to do was
local click = weap:GetDescendants();
for _, v in next, click do
if v:IsA("ClickDetector") then
--do something
end
end
77jaiz
(jaiz)
#3
You need a for loop for that, shown above this message
Crrustyy
(boblox_man)
#4
Cheers buddy! Helped and it worked!
1 Like