I have these 2 scripts that make when a part is touched it opens up a gui.
LocalScript:
local gui = script.ScreenGui
local brickTouchedEvent = game.ReplicatedStorage.Events.BrickTouched
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local char = player.Character or player.CharacterAdded:Wait()
brickTouchedEvent.OnClientEvent:Connect(function()
gui.Enabled = true
gui.Frame.bmw.GoLeftShowHOON.Visible = true
gui.Frame.bmw.GoRightShowPOR.Visible = true
gui.Frame.Close.Visible = true
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace.Cameras.BMWPart.CFrame
char.Humanoid.WalkSpeed = 0
end)
gui.Frame.Close.MouseButton1Click:Connect(function()
if camera.CameraType ~= Enum.CameraType.Custom then
repeat wait()
camera.CameraType = Enum.CameraType.Custom
until camera.CameraType == Enum.CameraType.Custom
end
camera.CameraSubject = char
char.Humanoid.WalkSpeed = 16
gui.Enabled = false
wait(4)
end)
Normal script:
local brick = script.Parent
local brickTouchedEvent = game.ReplicatedStorage.Events.BrickTouched
local debounce = false
brick.Touched:Connect(function(hit)
if not debounce then
debounce = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
brickTouchedEvent:FireClient(player)
print(player.Name.."opened the gui!")
wait(4)
debounce = false
end
end)
Now, I have a probem wich is when 4 seconds passes it opens the gui again so if I went to the other camera and textbuttons it woud reset to the camera and textbuttons that come up when the gui is active, and I don't know what should I use since I can't check if my gui is already active or not.
