Why is the gui only working in Studio and not in Regular Play(Please Read)?
Leaderboard part-
01 | game.Players.PlayerAdded:connect( function (Player) |
02 | local leaderstats = Instance.new( "IntValue" ,Player) |
03 | leaderstats.Name = "leaderstats" |
05 | local Level = Instance.new( "IntValue" ,leaderstats) |
08 | local XP = Instance.new( "IntValue" ,leaderstats) |
11 | local Coins = Instance.new 'IntValue' |
13 | Coins.Parent = leaderstats |
15 | local Gems = Instance.new( "IntValue" ,leaderstats) |
18 | XP.Changed:connect( function () XPChange(Player,XP,Level) end ) |
22 | function XPChange(Player,XP,Level) |
23 | if XP.Value > = Level.Value* 150 then |
25 | Level.Value = Level.Value+ 1 |
The script is under Workspace
Gui Part-
04 | local XP = script.Parent.Parent.Parent.Parent.Parent.leaderstats.XP.Value |
05 | local MaxXP = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level.Value* 150 |
07 | local math = ( XP / MaxXP ) |
08 | repeat wait() until script.Parent.Parent.Parent.Parent.Parent |
09 | script.Parent:TweenSize(UDim 2. new(math, 0 , 1 , 0 ), "Out" , "Quad" ,. 25 ) |
The script is inside a frame which is inside another frame in a screengui.