president vankk
Web Developer & AuraOT Owner
- Joined
- Jul 10, 2009
- Messages
- 5,719
- Solutions
- 9
- Reaction score
- 339
Hi my dear friends,
I'm trying to create a reward system and I'm getting a problem to give the reward.
On lib.lua
actions
And the error that I'm getting is
data/lib/core/reward.lua:16: attempt to index local 'reward' (a number value)
Can someone help me on that?
Thanks.
I'm trying to create a reward system and I'm getting a problem to give the reward.
On lib.lua
Code:
local config = {
rewards = {
{itemId = 9074, count = 1},
{itemId = 2157, count = 1},
{itemId = 18423, count = 1},
}
}
function reward.addReward(self, playerId)
local reward = math.random(#config.rewards)
if not reward then
return
end
local player = Player(playerId)
if not player or not player:addItem(reward.itemId, reward.count) then
return
end
end
actions
Code:
reward:addReward(player)
And the error that I'm getting is
data/lib/core/reward.lua:16: attempt to index local 'reward' (a number value)
Can someone help me on that?
Thanks.