RemoteEvent doesn't exist according to script even though it does

I am trying to make a warning system that doesn’t allow people to curse and I came up with a good script so far, however one line is erroring and I need HELP. I have 40 minutes to finish this as it needs to be done before I go to bed and the grand opening of the game is tomorrow. How do I fix this?

local Event = game.ReplicatedStorage.Warning -- add an event called "Warning" in ReplicatedStorage
local filterFunction = game.ReplicatedStorage.FilterWarn -- add a function called "FilterWarn" in ReplicatedStorage

The error is just listing the location of the item and the other error says “Infinite yield possible on it”.

Full Local-Script:

local Event = game.ReplicatedStorage.Warning -- add an event called "Warning" in ReplicatedStorage
local filterFunction = game.ReplicatedStorage.FilterWarn -- add a function called "FilterWarn" in ReplicatedStorage

Event.OnClientEvent:Connect(function(Reason,PlayerToWarn)
	local WarningGUI = PlayerToWarn.Character.Head.WarningGUI
	local CurrentWarnings = WarningGUI.Warnings
	local filteredText = filterFunction:InvokeServer(Reason) -- will filter the warn reason

	CurrentWarnings.Value = CurrentWarnings.Value + 1
	WarningGUI.WarningLabel.Text = "W" .. CurrentWarnings.Value .. " - " .. Reason

	if CurrentWarnings.Value >= 3 then
		PlayerToWarn:Kick("You've reached the maximum number of warnings and have been kicked from the server.")
	end
end)

Nevermind I forgot to add the remote event to the main game xd

1 Like