✓ Accepted answer
This is a Common Mistake
You actually want the PlayerGui, not the StarterGui service.
local plr = game.Players.LocalPlayer
local plrGui = plr:WaitForChild("PlayerGui")
local screenGui = plrGui:WaitForChild("ScreenGui")
if script.Parent.Equipped == true then
screenGui.Enabled = true
end
if script.Parent.Unequipped == false then
screenGui.Enabled = false
end
Next, this isn't connected to any event, so it'll only fire once, and never update. To fix this, lets use some events.
local plr = game.Players.LocalPlayer
local plrGui = plr:WaitForChild("PlayerGui")
local screenGui = plrGui:WaitForChild("ScreenGui")
local tool = script.Parent
tool.Equipped:Connect(function()
screenGui.Enabled = true
tool.Unequipped:Wait()
screenGui.Enabled = false
end)