Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

4 comments

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.

0

Well there error that you're getting is showing up because the values don't exist by the time you're doing that.

0

Perhaps I could extend the wait()?

0

Now I'm getting no errors, and the script isn't working...

This discussion is preserved as it was. New answers, comments, and votes are closed.