Attempt To Call A Number Value

Yeah, I have no idea why this error is being produced, I’m passing a player and the Name of an item I want to give to the player

Error Being Produced:
image

Sender:

if #PlayerData.Data.Names < 1 then
		print("Giving default name")
		PlayerData.GiveName(plr,"Default") --Eror Right Here
	end

Receiver:

function module.GiveName(player: Player, name)
	local profile = module.Profiles[player]
	if not profile then return end

	print("Giving player name: " .. name)

	table.insert(profile.Data.Names, name)
	module.LoadUI(player, "Name")
end

For Reference, I’m Using ProfileService and for some odd reason it is also producing This Error:

ServerScriptService.Libs.ProfileService:1077: attempt to call a number value
1 Like

What the error implies is that the above is a number instead of a function. Can you one line above add print(PlayerData.GiveName)?

Okay now I’m really confused it printed as a 0 but it is a function as stated before

1 Like

Can you show where PlayerData is defined in the script?

local module = {
	InventorySpace = 0,
	RibbonCrates = 0,
	RainbowCrates = 0,
	Money = 0,
	SkipCoins = 0,
	Gems = 0,
	Trophies = 0,
	Deaths = 0,
	SpeedMultiplier = 0,
	JumpMultiplier = 0,
	DailyGroupRewardTime = 0,
	TradesEnabled = false,
	Rebirth = 0,
	Boosts = {
		["2xCoins15"] = 0,
		["2xCoins30"] = 0,
		["2xGems15"] = 0,
		["2xGems30"] = 0,
		["2xWins15"] = 0,
		["2xWins30"] = 0,
		["50Faster15"] = 0,
		["100Faster15"] = 0,
		["Lucky15"] = 0
	},
	Statistics = {
		CheckpointsClaimed = 0, --
		TimePlayed = 0, --
		GamesPlayed = 0, --
		Finishes = 0,
		AmountOfCoinsCollected = 0, --
		Wins = 0,--
		Trophies = 0
		
	},
	QuestDataStatistics = {
		DailyQuestTime = 0,
		CurrentQuests = {},
		CurrentQuestReward = 0,
		CheckpointsClaimed = 0,
		TimePlayed = 0,
		GamesPlayed = 0,
		AmountOfCoinsCollected = 0,
		Finishes = 0,
		Trophies = 0

	},
	DailyQuests = {},
	Names = {},
	Trails = {},
	UsedCodes = {},
	Equiped = {
		Trail = "",
		Boosts = {},
		Name = "",
	}
}

return module

Here it is it’s a module with all of the data than can be used

Sorry I just realised you didn’t ask for that

local PlayerData = PlayerProfile.Profiles[plr]
1 Like

I meant in the script where the error happens. Do you have a spot somewhere where you do like:

local PlayerData = ...

Would you be able to add a similar print we did earlier but instead print(PlayerData) ?

Could you send line 56 from the Loader2 script?

OP Already provided that in the original post :smiley:

1 Like

Okay, it prints the entire PlayerProfile

image
Inside Data Tab:
image

Alrighty, from the looks of it you haven’t specifically defined GiveName in those objects. This makes me think that ProfileService most likely has some inner workings that returns the 0. My advice would be to Implement the GiveName method in some other object and not directly in the profile.

Hope that helps :smiley:

3 Likes

Ohh god, I feel like an idiot right now, pretty much I was using PlayerData instead of PlayerProfile (which is a module script) well this is the consequence of copy and pasting scripts without checking them out thoroughly, I got it fixed thank you for the help!

No problem! Glad you got it working in the end :smiley: these silly little mistakes happen to all of us

2 Likes