Hello, as you can see in the title, I noticed that when I fire the server, I made an if statement that checks what the name of the object is. I noticed that the script returns my username. I have checked the function but it shows me variant arguments. I have passed an argument in the event. I also checked OnServerEvent and it returns a player argument and tuple variant arguments I have tried two arguments however, it didn't work.
Here is the script in ServerScriptService
math.randomseed(tick())
local mapFolder = game:GetService("ServerStorage"):WaitForChild("Maps")
local event = game:GetService("ReplicatedStorage"):WaitForChild("GameEvent")
local playerAmount = workspace:WaitForChild("PlayerCount").Value
local maps = {
mapFolder:WaitForChild("Map1"),
mapFolder:WaitForChild("Map2"),
mapFolder:WaitForChild("Map3")
}
event.OnServerEvent:Connect(function(roundObj)
if roundObj then print(roundObj.Name) else print("RoundObj nil") end
if playerAmount >= 3 then
for countdown = 10,0,-1 do
roundObj = "Game starting in " .. countdown .. " seconds!"
wait(1)
end
local map = maps[math.random(1,#maps)]:Clone()
if map.Name == "Map1" then
roundObj = "Map chosen: Flood Escape "
end
if map.Name == "Map2" then
roundObj = "Map chosen: something"
end
if map.Name == "Map3" then
roundObj = "Map chosen: idk"
end
roundObj = map.Name .. " has been chosen"
map.Parent = workspace
else
roundObj = "You need ".. 3 - playerAmount .. " players to start a game"
end
end)
Here is the local script in StarterGui
local event = game:GetService("ReplicatedStorage"):WaitForChild("GameEvent")
local player = game.Players.LocalPlayer
local playerUI = player:WaitForChild("PlayerGui")
local intermission = playerUI:WaitForChild("IntermissionGui"):WaitForChild("IntermissionTxt").Text
event:FireServer(intermission)

3 comments
Then I would have to do like event.OnServerEvent:Connect(function(player, roundObj)?
Plus I have done the FireServer in a LocalScript, and it has local player, event:FireServer(player,intermission)?
You don't need to use FireServer with the player, it automatically puts the player in the first parameter