Attempt to call a number value

Hey ,
I ran into problem with datastore2 . I try to incrementing number but I got problem that says

attempt to call a number value

I dont understand what its mean cuz I don’t see any wrong in my script . Any help is appriciated :slight_smile:

this is the script from server:

reps.RemoteEvent.Data.MaxExp.Incrementing.OnServerEvent:Connect(function(player , num)

	local key4 = datastore2("Sheesh" , player)
	key4:Increment(num , Def_Val)

end)

this from client:

game.ReplicatedStorage.RemoteEvent.Data.MaxExp.Incrementing:FireServer(100)
1 Like

When you call Incrementing:FireServer(100), you only supply one parameter: 100. And Incrementing.OnServerEvent:Connect(function(player , num) supports two parameters: player and num, so it thinks you’re calling 100 on the player parameter, and nil on num parameter.

so I need to put player in the Incrementing:FireServer() parameter ??

Whatever player is, yes. It could be an Object, in which case you’d need to supply a path to it, or a string, in which case you just put ("player", 100) as the parameters

Wrong, since this is a RemoveEvent, when calling :FireServer, function supplies the player as the first parameter automatically when firing the OnServerEvent, any other argument after the 1st parameter is added are the arguments passed with :FireServer by developer. There is nothing wrong in that regard in the code OP provided.

1 Like

So what should i put in the parameter

Your parameters should stay the same as there is nothing wrong with them.
I’m more concerned about which line does this error pop up on, it would be nice if you can point it out for us.