What solutions have you tried so far? I’ve looked around, I’ve checked the Developer Hub. I know what the problem is. I just don’t know how to fix it. I want to get the returned value (MULTI) but it’s trying to give me the for i, v in pairs information also.
How would I get just the returned Multi value?
local function getMultiplier(Player, Multipler1)
local Multi = 0
for i,v in pairs(Player.Pets:GetChildren()) do
if v.Equipped.Value == true then
Multi = Multi + v[Multipler1].Value
end
end
return Multi
end
local multi = getMultiplier()
print(multi)
21:09:04.738 ServerScriptService.Script:7: attempt to index nil with 'Pets' - Server - Script:7
21:09:04.738 Stack Begin - Studio
21:09:04.738 Script 'ServerScriptService.Script', Line 7 - function getMultiplier - Studio - Script:7
21:09:04.739 Script 'ServerScriptService.Script', Line 15 - Studio - Script:15
21:09:04.739 Stack End - Studio
21:17:47.339 ServerScriptService.Script:9: invalid argument #2 (string expected, got nil) - Server - Script:9
21:17:47.339 Stack Begin - Studio
21:17:47.339 Script 'ServerScriptService.Script', Line 9 - function getMultiplier - Studio - Script:9
21:17:47.339 Script 'ServerScriptService.Script', Line 16 - Studio - Script:16
21:17:47.339 Stack End - Studio