
Image taken from TopbarPlus module
Assuming you’re using the TopbarPlus module, this might be the proper way to use selected and deselected
local Icon = require(game:GetService("ReplicatedStorage").Icon)
local Sound = game.StarterGui.Sounds.BackgroundMusic
local icon = Icon.new()
:setLabel("Respawn", "selected")
:setLabel("Respawn", "deselected")
:setLabel("Reset Your Character!", "hovering")
:setProperty("deselectWhenOtherIconSelected", false)
icon:setMid()
icon:bindEvent("selected", function(icon)
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
icon:deselect()
Humanoid.Health = 0
print("hi")
end)
icon:bindEvent("deselected", function(icon)
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
Humanoid.Health = 0
print("hi")
end)