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
10 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:

01game.Players.PlayerAdded:connect(function(plr)
02    wait(5)
03    local e = plr.leaderstats.Experience
04    local l = plr.leaderstats.Level
05    local ml = plr.leaderstats.Level.MaxLevel
06    local en = plr.leaderstats.Experience.ExperienceNeeded
07    if e.Value >= en.Value then
08        l.Value = l.Value + 1
09        e.Value = e.Value - en.Value
10        en.Value = en.Value*1.10409
11    end
12    if l.Value == ml.Value then
13        en.Value = nil
14    end
15end)

dealer script:

01local gt = game.Workspace.gameRunner.gameTime
02local Debounce = false
03game.Players.PlayerAdded:connect(function(plr)
04    wait(5)
05    local p = plr.leaderstats.Points
06    local m = plr.leaderstats.Money
07    local e = plr.leaderstats.Experience
08    if gt.Value == 1 and Debounce == false then
09        Debounce = true
10        m.Value = m.Value + p.Value/2
11        e.Value = e.Value + p.Value
12        p.Value = p.Value - p.Value
13        wait(1)
14        Debounce = false
15    end
16end)

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

1 answer

Log in to vote
3
Answered by 10 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 — 10y
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 — 10y
0
Perhaps I could extend the wait()? novipak 70 — 10y
0
Now I'm getting no errors, and the script isn't working... novipak 70 — 10y
Ad

Answer this question