local RemoteEvent = Replicated:WaitForChild("VaccumEvent")
local player = game.Players.LocalPlayer
local tool = script.Parent
local sound = tool:WaitForChild("Sound")
RemoteEvent.OnClientEvent:Connect(function(action)
local cleaninggui = player:WaitForChild("PlayerGui"):WaitForChild("VaccumUI").CleaningGUI
cleaninggui.Visible = false
end)
RemoteEvent.OnClientEvent:Connect(function(action)
if action == "ShowGUI" then
local cleaninggui = player:WaitForChild("PlayerGui"):WaitForChild("VaccumUI").CleaningGUI
cleaninggui.Visible = true
end
end)
local cleaninggui = player:WaitForChild("PlayerGui"):WaitForChild("VaccumUI").CleaningGUI
local ONButton = cleaninggui.CleaningFrame1.ONButton
local OFFButton = cleaninggui.CleaningFrame1.OFFButton
ONButton.MouseButton1Click:Connect(function()
sound:Play()
end)
OFFButton.MouseButton1Click:Connect(function()
sound:Stop()
end)
local Replicated = game:GetService("ReplicatedStorage")
local RemoteEvent = Replicated:WaitForChild("VaccumEvent")
local RemoteEvent2 = Replicated:WaitForChild("VaccumEvent2")
local CleaningGUI = game.StarterGui.VaccumUI.CleaningGUI
local tool = script.Parent
tool.Equipped:Connect(function()
local player = game.Players:GetPlayerFromCharacter(tool.Parent)
if player then
RemoteEvent:FireClient(player, "ShowGUI")
end
end)
tool.Unequipped:Connect(function()
CleaningGUI.Visible = false
end)
I’m trying to make it possible to hide the GUI without using another RemoteEvent, does anyone have any pointers?