#Guys can someone help me fix the issue?

10 messages · Page 1 of 1 (latest)

ancient terrace
#

local module = {}

function module:Create(player: Player, profile)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local rolls = Instance.new("IntValue")
rolls.Name = "Rolls"

if type(profile.Data.Rolls) == "number" then
    rolls.Value = profile.Data.Rolls
else
    rolls.Value = 0 -- Set a default value if profile.Data.Rolls is not a number
end

rolls.Parent = leaderstats

end

return module

and i always get this error message: ServerScriptService.Modules.DataManager.Leaderstats:6: invalid argument #3 (Instance expected, got table)
And i cant find the issue. can anyone help?

#

basically i dont know what to fix

ancient terrace
#

no idea

sick fable
#

to start with, you appear to be checking and setting the value to profile.Data.Rolls, which is not a number.

#

another possibility is that player is not equal to an instance

pastel needle
#

Please don't use the colon like you did unless you know what OOP is and you're doing it on purpose

gritty veldt