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

(uses Exp system) Why does this happen only on roblox edit and not in the game?

repeat wait(0.01) game.Players.LocalPlayer.leaderstats.XP.Value = game.Players.LocalPlayer.leaderstats.XP.Value + 5 if script.Parent.ExpChange.Value == game.Players.LocalPlayer.leaderstats.XP.Value then game.Players.LocalPlayer.leaderstats.XP.Value = game.Players.LocalPlayer.leaderstats.XP.Value - script.Parent.ExpChange.Value game.Players.LocalPlayer.leaderstats.Level.Value = game.Players.LocalPlayer.leaderstats.Level.Value + 1 if game.Players.LocalPlayer.leaderstats.Level.Value == 5 then script.Parent.ExpChange.Value = 2000 end if game.Players.LocalPlayer.leaderstats.Level.Value == 10 then script.Parent.ExpChange.Value = 2500 end if game.Players.LocalPlayer.leaderstats.Level.Value == 15 then script.Parent.ExpChange.Value = 3000 end if game.Players.LocalPlayer.leaderstats.Level.Value == 20 then script.Parent.ExpChange.Value = 3500 end if game.Players.LocalPlayer.leaderstats.Level.Value == 25 then script.Parent.ExpChange.Value = 4000 end if game.Players.LocalPlayer.leaderstats.Level.Value == 30 then script.Parent.ExpChange.Value = 4500 end if game.Players.LocalPlayer.leaderstats.Level.Value == 35 then script.Parent.ExpChange.Value = 5000 end if game.Players.LocalPlayer.leaderstats.Level.Value == 45 then script.Parent.ExpChange.Value = 5500 end if game.Players.LocalPlayer.leaderstats.Level.Value == 55 then script.Parent.ExpChange.Value = 6000 end if game.Players.LocalPlayer.leaderstats.Level.Value == 65 then script.Parent.ExpChange.Value = 6500 end if game.Players.LocalPlayer.leaderstats.Level.Value == 80 then script.Parent.ExpChange.Value = 7000 end if game.Players.LocalPlayer.leaderstats.Level.Value == 95 then script.Parent.ExpChange.Value = 7500 end end

until game.Players.LocalPlayer.leaderstats.Level.Value == 100

-- I have ExpChange as an IntValue, for some reason when I play it gets disrupted by something...

4 comments

0

it might not work from a localscript

0

try this

0

Format your code using Lua Code block

0

no

1 answer

✓ Accepted answer
game.Players.PlayerAdded:Connect(function(player)
local Exp = player.leaderstats:WaitForChild("XP")
local Level = player.leaderstats:WaitForChild("Level")
	while true do
	wait(0.01)
	Exp.Value = Exp.Value + 5
		if script.Parent.ExpChange.Value == Exp.Value then
		Exp.Value = Exp.Value - script.Parent.ExpChange.Value
		Level.Value = Level.Value + 1
			if Level.Value == 5 then
			script.Parent.ExpChange.Value == 2000		
			end
		end
	end
end)

this should get you started. if it doesnt work, it's because i typed it here, from your code

you should learn to use variables like i did also.

and remember to put your code in code blocks in the future (the blue Lua Button above the type box)

2 comments

1

let me test it in the game mode, by the way on line 13 script.Parent.ExpChange.Value = 2000 not ==

1

btw it didn't work

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