Script Yielding Infinitely?

I’m currently in the last steps of my lockdown system but the only thing wrong is that an infinite yield is occurring and I’m unsure on how to stop this. I’ve tried adding a wait but it waits then still yields infinitely?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LockdownEvent = ReplicatedStorage:WaitForChild("LockdownEvent")

local function onLockdownEvent(action)
	if action == "start" then
		wait(2)
		game.StarterGui.ScreenGui.Frame.Visible = true
	end

	if action == "end" then
		wait(2)
		game.StarterGui.ScreenGui.Frame.Visible = false
	end
end

show the error message for me! I don’t know where error? But are you sure the name LockdownEvent is same on game

This is not in ReplicatedStorage.

Hmm… how do I make that so??

image

Create a remote event called ‘ LockdownEvent ‘ in replicated storage.