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)