Local script:
local mouse = game.Players.LocalPlayer:GetMouse() mouse.Button2Down:Connect(function() script.Parent.Parent.PlayerGui.ScreenGui.ImageLabel.Visible = true --this makes it true so it then is visible end) mouse.Button2Up:Connect(function() script.Parent.Parent.PlayerGui.ScreenGui.ImageLabel.Visible = false end)
if tool.Equipped then, or you could do tool.Equipped:Connect(function()
You could have just one script entirely in that certain weapon, something like this:
LocalScript btw.
local weapon = script.Parent --this would be the tool, change it to where ever the tool is. local equipped = false local mouse = game.Players.LocalPlayer:GetMouse() weapon.Equipped:Connect(function() equipped = true end) weapon.Unequipped:Connect(function() equipped = false end) mouse.Button2Down:Connect(function() if equipped then -- your GUI code here. end end) mouse.Button2Up:Connect(function() -- GUI code to disable the GUI here. end)
Hope this helps.