game.Players.PlayerAdded:connect(function(player)
	while wait() do
		local level = player:WaitForChild("leaderstats"):WaitForChild("Level")		
		local exp = player:FindFirstChild("leaderstats"):FindFirstChild("Exp")
		local extraLevel = level.Value
		local expNeeded = ((extraLevel * 2) - 1) * 300
		
		if level.Value < maxLevel then
			if exp.Value >= expNeeded then
				player.Cash.Value = player.Cash.Value + 50
				level.Value = level.Value + 1
				exp.Value = exp.Value - expNeeded
 				levelupframe:TweenPosition(UDim2.new(0.5, -150, 0.5, -50), "Out", "Quad", 1, false)
				leveluptext.Text =  "You have leveled up to Level: " .. level.Value 
				player.Cash.Value = player.Cash.Value + 50
	        	levelupframe:TweenPosition(UDim2.new(0, -300, 0.5, -50), "Out", "Quad", 1, false)
			end
		end
	end
end)

I have this that levels the player up when they get enough exp. But the gui that should show up stays in the center of the screen. Please help.

4 comments

0

Is there any error?

1

Also, where are you defining levelupframe?

0

Does the GUI tween to the center of the screen and stay there, or is it there from the start?

0

@Blue there is no error, @warlord I defined them at the top of the script, but my script is like 400 lines long, plus is would print an error in output if I didnt define them, @yumtaste its suppose to go to centre then go back down of the screen, but nothing happens