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

Why is the gui only working in Studio and not in Regular Play(Please Read)?

Asked by 6 years ago

Leaderboard part-

game.Players.PlayerAdded:connect(function(Player) 
    local leaderstats = Instance.new("IntValue",Player) 
    leaderstats.Name = "leaderstats"

    local Level = Instance.new("IntValue",leaderstats)
    Level.Name = "Level" 
    Level.Value = 1 
    local XP = Instance.new("IntValue",leaderstats) 
    XP.Name = "XP" 
    XP.Value = 5
    local Coins = Instance.new'IntValue'
    Coins.Name = 'Coins'
    Coins.Parent = leaderstats
    Coins.Value = 100
    local Gems = Instance.new("IntValue",leaderstats)
    Gems.Value = 5
    Gems.Name = "Gems"
    XP.Changed:connect(function() XPChange(Player,XP,Level) end) 

end)

function XPChange(Player,XP,Level) 
    if XP.Value >= Level.Value*150  then 
        XP.Value = 0 
        Level.Value = Level.Value+ 1
    end
end

The script is under Workspace

Gui Part-

while true do
    wait()

    local XP = script.Parent.Parent.Parent.Parent.Parent.leaderstats.XP.Value
    local MaxXP = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level.Value*150

    local math = ( XP / MaxXP )
    repeat wait()until script.Parent.Parent.Parent.Parent.Parent
    script.Parent:TweenSize(UDim2.new(math,0,1,0),"Out","Quad",.25)
end

The script is inside a frame which is inside another frame in a screengui.

0
What does your Output say? Hydrogyn 155 — 6y
0
Nothing it works in studio but in game it doesnt do you mean the output in a normal play mode? duckyo011 36 — 6y
0
Found nothing in output duckyo011 36 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

You have to put the GUI in StarterGui.

0
dude i did xD duckyo011 36 — 6y
0
Its not that lol duckyo011 36 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

If your server is in Filtered Enabled, then you may have to connect a RemoteEvent onto the GUI to allow it to switch teams.

0
Let me try it duckyo011 36 — 6y

Answer this question