How do I , make these functions function

I am trying to learn new things , but I hate it when I get stuck on things that most likely have a small fix basically, I am trying to get a multipliers from some pets folder and add that to the points giving.

local ClickDetector = script.parent
function onMouseClick(Player)
-- Here should be the rest of the script , but it has nothing to do with this topic.
-------------------------
	function getMultiplier(Player, Multiplier1)
			
			local Multi = 1
			for i,v in pairs(Player.Pets:GetChildren()) do
				if v.Equipped.Value == true then
					Multi = Multi + v[Multiplier1].Value
					
			
					
					
				end
			end
			return Multi
end
local Multiplier1 = getMultiplier()
local pointsamount = game.ServerStorage.Points.Value * Multiplier1()-trying to get the Multi from the function.
Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + pointsamount




clickDetector.MouseClick:connect(onMouseClick, getMultiplier)



1 Like

I believe you just need to call the onMouseClick function and then call the getMultiplier function.

1 Like

I think I did something wrong at:

function getMultiplier(Player, Multiplier1)
			
			local Multi = 1
			for i,v in pairs(Player.Pets:GetChildren()) do
				if v.Equipped.Value == true then
					Multi = Multi + v[Multiplier1].Value
				end
			end
			return Multi
end

Its not getting the “Multi”, it says "attempt to index nil with “Pets”

You aren’t passing player into the function. So it defaults to nil.