Argument 1 missing or nil

I’m trying to make a function in a module script that changes the BorderSizePixel of the gui selected. The module script doesn’t seem to be getting any object from the gui parameter though.

Module Script:

local module = {}
	findGui = script.Parent.Levels.ScrollingFrame

	function module:Hovering()
	   game.SoundService.Mouse_hover:Play()
	end

	function module:NotHovering()
	   game.SoundService.Mouse_hover2:Play()
	end

	function module:Selected(gui)
		local image = findGui:FindFirstChild(gui)
		if(image.BorderSizePixel == 0) then
		image.BorderSizePixel = 8
			for i,x in pairs(findGui:GetChildren()) do
				x.BorderSizePixel = 0
			end
		end
	end

	function module:Play()
		
	end
	
return module

Local Script:

local gui = script.Parent

local actions = require(script.Parent.Parent.Parent.Parent.SelectLevel)

gui.MouseEnter:Connect(function()
actions.Hovering()
end)

gui.MouseLeave:Connect(function()
actions.NotHovering()
end)

script.Parent.MouseButton1Click:Connect(function()
actions.Selected(gui.Name)
end)
1 Like

You’re calling the function incorrectly, use actions:Selected(gui.Name) and not actions.Selected(gui.Name).

2 Likes