How to check if you have something in a selection

I’m making a plugin and I wanted to check if there is anything inside the selection before I run any code, how would I do that?
I’ve tried

local selection = selectionService:Get()
		if selection then

But it returns “attempt to call a nil value”
If there any way to fix it / A better way to do it.

Thanks for any help.

Depends on the context of that error. The code you posted and the error don’t really go together.

local selectionService = game:GetService("Selection")
local get = selectionService:Get() 
if get then
    print("true")
end

This works fine for me and your code should work unless you wrongly defined selectionService. You can even test the code with the command bar by having something pre-selected before running it.