Needing help with "return"

I am making a handcuff system, and having trouble on how to use “return”, so i can use the player check, and get all of the players


function GetPlayers(plrFound)
	for _,FindPlayers in pairs(game.Players:GetChildren()) do
		if FindPlayers.Name == game.Workspace:FindFirstChildWhichIsA("Model") then
			print(plrFound)
			return plrFound == FindPlayers
		end
	end
end

function ApplyLEO(Plr)
	cs:AddTag(Plr,"LEO")
	
end

function ApplyArrest(plr)
	local player
end

The keyword return is treated as an output method of a function commonly. e.g.

local function useReturn()
    return "This is a string being outputted from this function!"
end

print(useReturn())

You can definitely assign the returned value as a variable like this:

local returnedString = useReturn()
1 Like

i see, thank u for the help

ignore ignore ignore

Don’t forget to mark his answer as the solution if that was answer to your question.

In your code example I think you would like to change a few things, but I’m just guessing on intended results from your function names.

You have a function GetPlayers, but it will only return true/false (if found), while the name suggests it will return multiple players. If you only want the function to return true/false then you should name it findPlayer as it more accurately describes what it does. If you wish to get help regarding how to write the code please describe your intended functionality and I’ll try to help you.