Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

I got help from a person, but my level up script still won't work. Why?

Asked by
3DMage -2
6 years ago
Edited 6 years ago

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
0
The first script is a local script correct ? yHasteeD 1819 — 6y
0
And remember to change value with server. yHasteeD 1819 — 6y
1
this guy clearly diddnt script it tacotown2 119 — 6y
0
also, don't use the parent argument of Instance.new theking48989987 2147 — 6y
View all comments (6 more)
2
this script is from a tutorial tacotown2 119 — 6y
0
oof. can you just fix the script for me. 3DMage -2 — 6y
0
show that you attempted first if we just give you the fixed script we're not helping you User#22604 1 — 6y
0
I have to mention that I got 90% of the script from a youtube video. Im trying to learn to script. 3DMage -2 — 6y
0
Downvoted for saying "can you just fix the script for me." And YouTube tutorials suck. They teach bad code. User#19524 175 — 6y
0
what is downcoded 3DMage -2 — 6y

Answer this question