im setting a bool value to false whenever my round system is in intermission
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Custom
repeat wait()
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = workspace.Lobby.LobbyCamera.CFrame
local GameMap = workspace.Map.CurrentMap
local function Play()
workspace.Values.CanPlay.Changed:Connect(function(newValue)
print(newValue)
if newValue == true then
script.Parent.Activated:Connect(function()
game:GetService("ReplicatedStorage").Remotes.AddCharacterEvent:FireServer()
camera.CameraType = Enum.CameraType.Custom
script.Parent.Visible = false
script.Parent.Parent.Character.Visible = false
script.Parent.Parent.Stats.Visible = false
script.Parent.Parent.LoadoutButton.Visible = false
script.Parent.Parent.CustomizeButton.Visible = false
script.Parent.Parent.Code.Visible = false
script.Parent.Parent.PremiumButton.Visible = false
script.Parent.Parent.StoreButton.Visible = false
script.Parent.Parent.Map.Visible = false
script.Parent.Parent.Yen.Visible = false
script.Parent.Parent.Bloodfruit.Visible = false
script.Parent.Parent.Parent.Level.LevelBar.Visible = true
script.Parent.Parent.Parent.Level.LevelStats.Visible = true
game.Lighting.Blur.Size = 1
player.Character:WaitForChild("HumanoidRootPart").Anchored = false
end)
end
end)
end
script.Parent.Activated:Connect(function()
Play()
end)
UIS.InputBegan:Connect(function(Input, Processed)
if Input.KeyCode == Enum.KeyCode.Space and not Processed then
Play()
end
end)
however even when the bool value is set to false this is still running and idk why, it works perfectly fine for the very first round and then once its set to false again this will still be doing whats inside the function.