When I change the XP value, the level up bar doesn't move at all. -Here is the Script for the frame.
repeat wait() until game.Players.LocalPlayer local Player = game.Players.LocalPlayer local Data = Player:FindFirstChild("Data") local XP = Data.XP local Max_XP = 10000 while wait() do local XPMat = ( XP.Value / Max_XP ) script.Parent:TweenSize(UDim2.new(XPMat,0,1,0),"Out","Quad",.25) end
-Here's the script for ServerScriptService
local Max_XP = 10000 local Max_Level = 150 game.Players.PlayerAdded:connect(function(Player) local Data = Instance.new("IntValue",Player) Data.Name = "Data" local XP = Instance.new("IntValue",Data) XP.Name = "XP" XP.Value = 100 local Level = Instance.new("IntValue",Data) Level.Name = "Level" Level.Value = 1 local Tries = Instance.new("IntValue",Data) Tries.Value = 10 Tries.Name = "Tries" XP.Changed:connect(function() XPChange(Player,XP,Level) end) end) function XPChange(Player,XP,Level) if XP.Value >= Max_XP and Level.Value <= Max_Level then XP.Value = 0 Level.Value = Level.Value + 1 else return false; end end
-My first script for Frame attempt
while true do wait() local XP = script.Parent.Parent.Parent.Parent.Parent.Data.XP.Value local MaxXP = script.Parent.Parent.Parent.Parent.Parent.Data.Level.Value*150 local math = ( XP / MaxXP ) script.Parent:TweenSize(UDim2.new(math,0,1,0),"Out","Quad",.25) end