Good afternoon everyone.
I’ve been trying to make a serverscript fire an event but something doesnt lets it.
It gives error “Argument 1 missing or nil”
I did everything right yet it still gives same error.
This is the script, if you can help me please answer.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local enterEvent = ReplicatedStorage:WaitForChild("enter")
local playersInList = {} -- Keep track of players who triggered the event
enterEvent.OnServerEvent:Connect(function(player, playerName)
table.insert(playersInList, playerName)
print(playerName .. " has entered the event.")
-- Check if all players are in the list
local allPlayersInList = true
for _, player in ipairs(Players:GetPlayers()) do
if not table.find(playersInList, player.Name) then
allPlayersInList = false
break
end
end
if allPlayersInList then
print("waiting 4 seconds and then crashing the lift with camera shake")
wait(4)
game.ReplicatedStorage.shake:FireClient()
end
end)