GUI enable on tool equip help

Hello forum members, I’ve experienced an issue while trying to make a phone GUI. I’ve been trying to make the phone GUI enable once you equip a tool and disable it when the tool gets unequipped. All the forum posts I’ve tried haven’t worked for me.

Current Code:

script.Parent.Equipped:Connect(function(plr)
plr.PlayerGui.PhoneGui.Enabled = true
end)

script.Parent.Unequipped:Connect(function(plr)
    plr.PlayerGui.PhoneGui.Enabled = false
end)

Because the parameter is a mouse not player. You’d need to define a player variable if you want to interact with their guis.

local plr = game.Players.LocalPlayer

script.Parent.Equipped:Connect(function()
    plr.PlayerGui.PhoneGui.Enabled = true
end)

script.Parent.Unequipped:Connect(function()
    plr.PlayerGui.PhoneGui.Enabled = false
end)
3 Likes