Itemgiver modulescript not working

You can write your topic however you want, but you need to answer these questions:

  1. I made a modulescript that will be used whenever i need to give a player an item but the function inputs are all messed up

  2. Whenever i run the function it says that character is not a valid member of tool “lighting.testtool”

local Module = require(game.ReplicatedStorage:WaitForChild("ItemManager"))
local item = game.Lighting.testtool
script.parent.Triggered:Connect(function(player)
	print(player,item)
	Module.GiveItem(player,item,true)
end)
local module = {}

function module:GiveItem(p,item,unique)
	print(p,item,unique)
	if unique then
		if not p.Backpack:FindFirstChild(item.Name)then
			if not p.Character:FindFirstChild(item.Name) then
				Give(p,item)
			end
		end
	elseif not unique then
		Give(p,item)
	end
end

function Give(player,item)
	print(player,item)
	player.Character.Humanoid:UnequipTools()
	if #player.Backpack:GetChildren() < 10 then
		local g = item:Clone()
		g.Parent = player.Backpack
	end
end

return module

Is there a reason why you’re using : instead of . for the function? That’s probably the first red flag and you should check and see if that’s what’s causing the problems.

1 Like

well i feel like an idiot now
thanks tho!