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

Level gui system help?

Long story short, im making a game where theres a level up system based on kills and I use the script

local maxlevel = 100
game.Players.PlayerAdded:connect(function(player)
	local stats = Instance.new("IntValue", player)
	stats.Name = "leaderstats"
	
	local level = Instance.new("IntValue", stats)
	level.Name = "Level"
	level.Value = 1
	
	local exp = Instance.new("IntValue", stats)
	exp.Name = "Exp"
	exp.Value = 0
	
	while wait() do
		local extralevel = level.Value
		local expneed = ((extralevel * 2) - 1) * 50
		if level.Value < maxlevel then
			if exp.Value >= expneed then
				level.Value = level.Value + 1
				exp.Value = exp.Value - expneed
			end
		end
	end
end)

2 questions: 1, I made a working gui version of displaying the level, HOWEVER it wont update when you level up it works the first time but wont no more, help, to go along with the leveling up. 2, Using this script how would I make it so if you kill someone you get exp?

1 comment

0

Can you show the script for the gui. Also you can use the Died Event on Humanoids to get Exp on kill

1 answer

Not sure as you don't have the script for the display but hopefully this fixes your problem.

local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
local level = stats:WaitForChild("level") -- change level to your statname

function update()
script.Parent.Text = level.Value
end

update()
level.Changed:connect()

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