I wish to add 5 exp to my exp bar once the npc is killed. this is the script to change the text when exp is received:
local player = game.Players.LocalPlayer local exp = player:WaitForChild("leaderstats"):WaitForChild("Exp") local axp = player:WaitForChild("leaderstats"):WaitForChild("ExpNeeded")
while true do wait() script.Parent.Text = "EXP: " .. exp.Value .. "/" .. axp.Value end And this is the script for the bar changing once the exp is gained:
local player = game.Players.LocalPlayer local exp = player:WaitForChild("leaderstats"):WaitForChild("Exp") local axp = player:WaitForChild("leaderstats"):WaitForChild("ExpNeeded")
while true do wait() local expBarSize = (exp.Value/axp.Value) - 0.02 if exp.Value == 0 then expBarSize = 0 script.Parent:TweenSize(UDim2.new(expBarSize, 0, 0, 20), "Out", "Linear", 0.25) else script.Parent:TweenSize(UDim2.new(expBarSize, 0, 0, 20), "Out", "Linear", 0.25) end end
and this is the script for leveling up once exp reaches a certain amount:
--GetLevel Script (Local Script) local player = game.Players.LocalPlayer local level = player:WaitForChild("leaderstats"):WaitForChild("Level")
script.Parent.Text = "Current Level: " .. level.Value
level.Changed:Connect(function(value) script.Parent.Text = "Current Level: " .. value end)
oh and I may of also made a mistake on which one functions which because i forgot to rename them once i made them, Sorry!

2 comments
Oh and sorry i have no idea how to use this website so i didn't make the script thing
your script is scary