My script is not working as it should

a gui is shown above my head that leans towards the player’s class, for example, I have a B-Class and after the player’s death, I have a default gui and I do not know how to fix it. help

local overheadGUIs = game.ServerStorage:WaitForChild("OverheadGUIs")
local ClassesGUI = overheadGUIs:WaitForChild("ClassesOverHead")
local character = script.Parent
local head = character.Head
local player = game.Players:GetPlayerFromCharacter(character)
local currentClass = player.leaderstats:WaitForChild("Class")

local ids = {
	FClass = "http://www.roblox.com/asset/?id=90395547935938", 
	EClass = "http://www.roblox.com/asset/?id=13537890076", 
	DClass = "http://www.roblox.com/asset/?id=14789258408", 
	CClass = "http://www.roblox.com/asset/?id=14789260188", 
	BClass = "http://www.roblox.com/asset/?id=14789262376", 
	AClass = "http://www.roblox.com/asset/?id=14789263743", 
	SClass = "http://www.roblox.com/asset/?id=14789265141", 
	SSClass = "http://www.roblox.com/asset/?id=14789267036", 
	SSSClass = "http://www.roblox.com/asset/?id=14789268533", 
	XClass = "http://www.roblox.com/asset/?id=14789270511", 
	YClass = "http://www.roblox.com/asset/?id=14789272766", 
	ZClass = "http://www.roblox.com/asset/?id=14789274018", 
	XYZClass = "http://www.roblox.com/asset/?id=14789275327"
}

local newClassesGUI = ClassesGUI:Clone()
newClassesGUI.Parent = head
newClassesGUI.Name = "OverheadClassesGUI"

currentClass.Changed:Connect(function()
	local classToChangeTo = currentClass.Value:gsub("-", "") -- string.gsub(currentClass.Value, "-", "")
	newClassesGUI.ImageLabel.Image = ids[classToChangeTo]
end)

I must have the gui that the player has, I don’t know what the problem is. Help me solve the problem. Any help is disgusting.

I found what the problem was and fixed it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.