Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

3 comments

0

What does your Output say?

0

Nothing it works in studio but in game it doesnt do you mean the output in a normal play mode?

0

Found nothing in output

2 answers

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

1 comment

0

Let me try it

This discussion is preserved as it was. New answers, comments, and votes are closed.