Custom function not working

i am trying to serialize a function and this is what it is.

function workspace:FindFirstChildWithTag(tag)
	for i,v in ipairs(thing:GetChildren()) do
		if v:HasTag(tag) then
			return v
		end
	end
end

but when i try to use it i get this error.
23:29:29.041 FindFirstChildWithTag is not a valid member of Workspace "Workspace" - Studio

this is how it’s supposed to be used.
local sword = workspace:FindFirstChildWithTag("melee")

what have i done wrong here?

workspace refers to the actual workspace service, you cannot make custom functions within it, same way as you cannot redeclare other luau variables such as table, print, and so on, you will have to rename your workspace object to something else