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

I don't Know Why I'm Getting These Errors?

Asked by
novipak 70
9 years ago

I'm trying to make it so that when the game ends, you get experience and money, and if you have a certain amount of experience you level up. Here are the errors I'm getting:

15:53:01.492 - Experience is not a valid member of IntValue 15:53:01.492 - Script 'Workspace.lvlDealer', Line 3 15:53:01.493 - Stack End

15:53:02.499 - Points is not a valid member of IntValue 15:53:02.500 - Script 'Workspace.dealer', Line 5 15:53:02.501 - Stack End

Here is my scripts.

lvl dealer script:

game.Players.PlayerAdded:connect(function(plr)
    wait(5)
    local e = plr.leaderstats.Experience
    local l = plr.leaderstats.Level
    local ml = plr.leaderstats.Level.MaxLevel
    local en = plr.leaderstats.Experience.ExperienceNeeded
    if e.Value >= en.Value then
        l.Value = l.Value + 1
        e.Value = e.Value - en.Value
        en.Value = en.Value*1.10409
    end
    if l.Value == ml.Value then
        en.Value = nil
    end
end)

dealer script:

local gt = game.Workspace.gameRunner.gameTime
local Debounce = false
game.Players.PlayerAdded:connect(function(plr)
    wait(5)
    local p = plr.leaderstats.Points
    local m = plr.leaderstats.Money
    local e = plr.leaderstats.Experience
    if gt.Value == 1 and Debounce == false then
        Debounce = true
        m.Value = m.Value + p.Value/2
        e.Value = e.Value + p.Value
        p.Value = p.Value - p.Value
        wait(1)
        Debounce = false
    end
end)

Thank you! It would be great if somebody could answer this :)

1 answer

Log in to vote
3
Answered by 9 years ago

You have to create the values before you can use them.

0
I did, in a separate script. I didn't think I had to show it since I wasn't getting errors in that script. novipak 70 — 9y
0
Well there error that you're getting is showing up because the values don't exist by the time you're doing that. NoahWillCode 370 — 9y
0
Perhaps I could extend the wait()? novipak 70 — 9y
0
Now I'm getting no errors, and the script isn't working... novipak 70 — 9y
Ad

Answer this question