Why am I getting an error?
A mistake in this moment - "plr.stat.curent.Value=plr.stat.curent.Value+1"
Script:
local Reward = require(game.ServerStorage:WaitForChild("Reward"))
local RewardData = Reward[1]
local stat=RewardData["stats"]
local curent=RewardData["curent"]
local reward=RewardData["reward"]
game.Players.PlayerAdded:Connect(function(plr)
plr.stat.curent.Value=plr.stat.curent.Value+1
end)
ModuleScript:
local day = {
[1]={
stats='PlayerStats',
curent='DoubleXP',
reward = 100000
}
}
return day

3 comments
This isn't a solution, but a better way to add or subtract from a value is "plr.stat.curent.Value += 1". Use a - for subtraction.
This is the error it gives me - "stat is not a valid member of Player "Players.ZaharKor12""
Did you check stat is a valid member then?