Indeed he has, and he has to change that approach.
tonumber(gems)
is nil, which means that whatever gems
is, it can’t be converted to a number. This is probably due to an error with RemoteEvent arguments.
Change this line here:
AddTrails.OnServerEvent:Connect(function(gems)
into this:
AddTrails.OnServerEvent:Connect(function(player, gems)
and let me know how it goes.
Yeah, he probably assigned player as gems.
Ok, I tried that, but it gives me the same exact error.
OnServerEvent gets the player
parameter first not gems. Do:
AddTrails.OnServerEvent:Connect(function(player, gems)
addTrails(gems)
end)
He tried that and got error again.
Maybe try
button.MouseButton1Click:Connect(function()
local gems = 50
AddTrail:FireServer(game.Players.LocalPlayer, gems)
end)
AddTrails.OnServerEvent:Connect(function(player, gems)
You’re calling the player parameter in this function without defining the player. Is player
already defined?
Yeah I think it would be defined and currency is a number, that means it is defined, gems is nil.
I mean Curreny.Value
could also be nil
Yes it is defined, I used it to set the database for the trails (the thing I’m working on)
Nope, it is a number, error is saying gems is nil.
Maybe try this method, Idk if it will work.
Can you try printing gems
? I’m not sure by can you remove the tonumber
before gems, it won’t make a difference but try print just “gems” without tonumber.
Print gems, we need to know what gems is.
He tried it and it was nil though.
This is most likely going to work but instead rather than passing the player parameter when firing, pass the player parameter when connecting the event. It solved a few solutions for me in the past because player trying to be accessed and the player given by the remote event might be different since it’s a server script etc.
It says that it is nil
(character min)
I dont know if this will actually work though.