Well, I made a round base system to just test my skills. I made a small Lobby and a text label that is at the top of the player’s screen. I made a remote event and fired it from a local script which is in starter gui. Local Script:
local intermissionEvent = game:GetService("ReplicatedStorage").IntermissionEvent
local intermissionLabel = script.Parent
intermissionEvent:FireServer(intermissionLabel)
And here is my server-script:
local intermissionEvent = game:GetService("ReplicatedStorage").IntermissionEvent -- Our Remote Event
local lobby = game.Workspace.Lobby
local teleportService = game:GetService("TeleportService") -- Teleport Service
local ebgID = 566399244 -- Elemental Battle Ground Game ID
intermissionEvent.OnServerEvent:Connect(function(player, intermissionLabel)
for second = 30, 0, -1 do -- Making Our Timer
intermissionLabel.Text = "Intermission: " .. second
wait(1)
end
print("Timer Finished!")
intermissionLabel.Visible = false
for _, player in pairs(game:GetService("Players"):GetChildren()) do
local char = game.Workspace:FindFirstChild(player.Name) -- Find the player's character
if char and char.HumanoidRootPart then -- If they have a character and a humanoidrootpart then
char.HumanoidRootPart.Position = lobby.Wall1.Position + Vector3.new(0,0, 33) -- Teleport them to the lobby
wait(10)
teleportService:Teleport(ebgID, player) -- Teleport them to elemental battle grounds
end
end
end)
Any feedback is appreciated!
Btw, elemental battle grounds is just game that I don’t own.
Hi, there! This might not be the best advice as I don’t completely understand the context in which you want the rounds to start, but if you’re concerned about security, I would avoid having the client fire the server. Rather, I would manage the rounds entirely on the server and have it automatically start the round if the requirements are met. For example,
local roundHasStarted = false
local function meetsRequirements()
-- add conditional statements here
return true
end
local function startRound()
for second = 30, 0, -1 do -- Making Our Timer
intermissionLabel.Text = "Intermission: " .. second
wait(1)
end
print("Timer Finished!")
intermissionLabel.Visible = false
for _, player in pairs(game:GetService("Players"):GetChildren()) do
local char = game.Workspace:FindFirstChild(player.Name) -- Find the player's character
if char and char.HumanoidRootPart then -- If they have a character and a humanoidrootpart then
char.HumanoidRootPart.Position = lobby.Wall1.Position + Vector3.new(0,0, 33) -- Teleport them to the lobby
wait(10)
teleportService:Teleport(ebgID, player) -- Teleport them to elemental battle grounds
end
end
end
game:GetService("Players").PlayerAdded:Connect(function(Player)
if meetsRequirements() == true and roundHasStarted == false then
startRound()
end
end)
Let me know if I can clarify anything for you!
1 Like
Yeah but you can’t get the ui label on the server?
You don’t have to! Rather than using any sort of remote event to send updates to the client, I like to do something like this.
Server Script:
local RoundStatus = Instance.new(“StringValue”)
RoundStatus.Name = “RoundStatus”
RoundStatus.Parent = game:GetService(“ReplicatedStorage”)
wait(5)
RoundStatus.Value = “The round will now begin!”
Local Script:
local RoundStatus = game:GetService(“ReplicatedStorage”):WaitForChild(“RoundStatus”)
local intermissionLabel = script.Parent
RoundStatus.Changed:Connect(function()
intermissionLabel.Text = RoundStatus.Value
end)
2 Likes