Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to add experience value every 5 sec?

Asked by
lyxture 27
9 years ago
game.Players.PlayerAdded:connect(function(plr)
    local stats = Instance.new('IntValue', plr)
    stats.Name = 'leaderstats'

    local experience = Instance.new('IntValue', stats)
    experience.Name = 'EXP'
    experience.Value = 0

    local level = Instance.new('IntValue', stats)
    level.Name = 'level'
    level.Value = 0

    experience.Changed:connect(function()
       level.Value = math.floor(experience.value / 1000)


    end)

end)



local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild('leaderstats')
local level = leaderstats:WaitForChild('level')
local xp = player:WaitForChild('exp')

level.Changed:connect(function()
    if xp.Value < 1000 then
        level.Value = 1

     end
end)

i tried really hard to make this but i don't know how to continue, i wanted it to give 100 'experience' every 5 seconds. thanks in advanced

0
my script works now i made a mistake in (experience.value / 1000) it should have been (experience.Value/ 1000) lyxture 27 — 9y

1 answer

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

Line 14 experience.value should be experience.Value

0
yeah i already said that lyxture 27 — 9y
0
but thanks either way lyxture 27 — 9y
Ad

Answer this question