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
plr.stat
doesn't exist. Instead, use the variable you set:
game.Players.PlayerAdded:Connect(function() curent.Value=curent.Value+1 end)
Also, instead, you should use curent.Value += 1
. It's another way to add to a value.