Bomb System Help

Hello. I am making a bomb system. The GUI shows up. But if I leave the bombsite the GUI is still there.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Code:

  local C4_PLANT_GUI = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui').C4_PLANT.Frame

local Backpack = game:GetService("Players").LocalPlayer:WaitForChild("Backpack")

local UIS = game:GetService("UserInputService")

local BOMBSITE = game.Workspace.Bombsite

local C4_PLANTING = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui').C4_PLANTING.TextLabel



	BOMBSITE.Touched:Connect(function(hit)
		if Backpack.C4 then
			if hit.Parent:FindFirstChild("Humanoid") then
				C4_PLANT_GUI.Visible = true

			end
		end
		if C4_PLANTING.Visible == true then
			C4_PLANT_GUI.Visible = false
		end


UIS.InputBegan:Connect(function(input, gameProcessed)
	if not gameProcessed then
		if input.UserInputType == Enum.UserInputType.Keyboard then
			local keycode = input.KeyCode
				if keycode == Enum.KeyCode.E then
					C4_PLANTING.Visible = true
				else
					C4_PLANTING.Visible = false
				end
		   end
	   end

end)
end)
1 Like

You would put that in a loop, other wise when you press E it will pop up and if you press another key it will close down.

1 Like

Wow that was really cool :slight_smile:

1 Like

Mark it as a solution if you liked it, I need some reputation on the forum. I hope you liked the solution :sunglasses: