I have no clue on how to wrap this with a pcall
xpFunction.OnServerInvoke=function(plr)
local key = 'Player-'..plr.userId
-- Checks if player has data that can be sent
if xpDataStore:GetAsync(key) then
return xpDataStore:GetAsync(key)
else
-- sets the xp to 0 if plr is new
xpDataStore:SetAsync(key,(0))
end
end
I have tried this
pcall(xpFunction.OnServerInvoke=function(plr)
local key = 'Player-'..plr.userId
-- Checks if player has data that can be sent
if xpDataStore:GetAsync(key) then
return xpDataStore:GetAsync(key)
else
-- sets the xp to 0 if plr is new
xpDataStore:SetAsync(key,(0))
end
end)
but there is an error with the "="

1 comment
You can change success and message to be whatever you like.