-
What do you want to achieve?
I want to my code work !
-
What is the issue?
I don’t understand why it doesn’t work !
-
What solutions have you tried so far?
Client side :
Players.PlayerRemoving:Connect(function()
Player.CharacterRemoving:Connect(function()
FDW = FDW + 10
RemoteEventFDW:FireServer(FDW)
end)
end)
Server side :
RemoteEventFirstTime.OnServerEvent:Connect(function(Player, FDW)
DataStoreFDW:SetAsync(Player.UserId, FDW)
end)
The error :
Argument 2 missing or nil
1 Like
Valkyrop
(JustAGuy)
#2
You forgot to put Player as an argument hers:
Players.PlayerRemoving:Connect(function(Player)
Player.CharacterRemoving:Connect(function()
FDW = FDW + 10
RemoteEventFDW:FireServer(FDW)
end)
end)
Tho I dont see any reason to do that.
You could simply do all the process on the server
1 Like
Thank but it doesn’t work again that put me the same error in the output !
Valkyrop
(JustAGuy)
#4
What is “FDW”? Could you show us
1 Like
“FDW” is the currency of the game !
Valkyrop
(JustAGuy)
#6
Try put .Value
when adding 10 to it.
1 Like
Valkyrop
(JustAGuy)
#7
Players.PlayerRemoving:Connect(function(Player)
Player.CharacterRemoving:Connect(function()
FDW.Value += 10
RemoteEventFDW:FireServer(FDW.Value)
end)
end)
1 Like
It is not a value object it is a variable !
could you try to print FDW? same with Player.UserId
1 Like
That print “nil” in the output !
im guessing FDW printed nil right?
1 Like
Yes it is ! (548469594251515)
wait so is that the value for FDW you got?
1 Like
its possible that the player might already be removed when its fired so the .UserId is nil
1 Like
“FDW” is nil and the other is the player UserID so I don’t know why “FDW” is nil !
nevermind could you try printing the FDW on the place that fires the remote?
1 Like
Mister33j
(qharntne)
#17
its because you never predefined it yet…
1 Like
Oh sorry I made a mistakes in my script it work now :
- Client side :
Players.PlayerRemoving:Connect(function()
Player.CharacterRemoving:Connect(function()
FDW = FDW + 10
RemoteEventFDW:FireServer(FDW)
end)
end)
Server side :
RemoteEventFDW.OnServerEvent:Connect(function(Player, FDW)
DataStoreFDW:SetAsync(Player.UserId, FDW)
end)
It’s work but your right the remote event doesn’t work because it isn’t fired at time !