I have this plugin script right here. However, it doesn't work. What's my issue? It yields Script.lua:9: attempt to call a nil value
local toolbar = plugin:CreateToolbar("Number of Descendants")
-- Add a toolbar button named "Create Empty Script"
local newScriptButton = toolbar:CreateButton("Get Number of Descendants", "Gets the numbre of descendants", "rbxassetid://4458901886")
local function onNewScriptButtonClicked()
local model = game.Selection:Get()
local descend = model:GetDescendants()
local number = #descend
print("number")
end
newScriptButton.Click:Connect(onNewScriptButtonClicked)

6 comments
What do you mean with ":Get()" on line 07? And what is "Selection"?
it's getting selection
Okay wait, I'll read up
Okay I've read. I don't think you should do ":GetDescendants()". Just do it directly "print(#model)"
nono won't work
Try copy all code that is inside the function and use it in the Command Box, Selection doesn't work in scripts