My jumpscare module doesn't work!

I am trying to make a system that jumpscares the player, but theres multiple jumpscare functions so that it doesn’t get repetitive.
However, I encountered an error with my code.

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Player = game:GetService("Players").LocalPlayer or game:GetService("Players").PlayerAdded:Wait()

local utilitiesTable = {
	["Functions"] = {
		"Appear",
		"ModifyAudios",
		"FlickerScreen",
		"EndgameSurprise"
	}
}

ReplicatedStorage.Remotes.DeiRemote.OnClientEvent:Connect(function(module, func)
	local newModule = require(module)
	if table.find(utilitiesTable.Functions, func) then
		newModule[func](true, 0.5, Player.PlayerGui.JumpscareGUI)
	end
end)

This is the code, and the remote that fires this OnClientEvent is this.

task.wait(10)
local ReplicatedStorage = game:GetService("ReplicatedStorage")

ReplicatedStorage.Remotes.DeiRemote:FireAllClients(ReplicatedStorage.Modules.DeiSpecialEvents, 2)

I have put a task.wait(10) for debugging purposes, even when I passed in a number value in the FireAllClients() function, it still doesn’t work but throws no errors.
However, when I put it like this. The code DOES work.

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Player = game:GetService("Players").LocalPlayer or game:GetService("Players").PlayerAdded:Wait()

local utilitiesTable = {
	["Functions"] = {
		"Appear",
		"ModifyAudios",
		"FlickerScreen",
		"EndgameSurprise"
	}
}

ReplicatedStorage.Remotes.DeiRemote.OnClientEvent:Connect(function(module, func)
	local newModule = require(module)
	newModule:ModifyAudios(true, 0.5, game.Players.LocalPlayer.PlayerGui.JumpscareGUI)
end)

How, really?
I am still confused.
Help would be appriciated!

Could you show a screenshot of the error?

I have changed a few things in the code, it shows no errors but it doesn’t work either. For some reason, the if table.find(utilitiesTable.Functions, func) then doesn’t run despite the fact that i passed in a number to the FireAllClients() function.

Could you explain the logic behind your code?
Also maybe try this out instead of using table.find.

if utilitiesTable.Func[func] then
–ur code
end

Well, the logic behind my code is that it SHOULD jumpscare all players in the server, despite the fact that the code doesn’t work.
Also, I tried that and it threw that WaitForChild error i was talking about.
image

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Player = game:GetService("Players").LocalPlayer

local utilitiesTable = {
	["Functions"] = {
		"Appear",
		"ModifyAudios",
		"FlickerScreen",
		"EndgameSurprise"
	}
}

ReplicatedStorage.Remotes.DeiRemote.OnClientEvent:Connect(function(module, func)
	local newModule = require(module)
	if utilitiesTable.Functions[func] then
		newModule[utilitiesTable.Functions[func]](true, 0.5, Player.PlayerGui.JumpscareGUI)
	end
end)

Nevermind, I fixed it myself, thanks for the help though!