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!