local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local RemoteEvent = ReplicatedStorage:WaitForChild("Intermission")
local TextLabel = StarterGui.ScreenGui:WaitForChild("TextLabel")
RemoteEvent.OnClientEvent:Connect(function()
for i = 10, 0, -1 do
task.wait(1)
TextLabel.Text = "Intermission: " .. i
end
end)
Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local textLabel = StarterGui.ScreenGui:WaitForChild("TextLabel")
local lobbyRemaining = 10
local timeRemaining = 10
local InGame = game.Workspace:WaitForChild("InGame")
local InLobby = game.Workspace:WaitForChild("InLobby")
local timeLeft = 10
local lobbyLeft = 10
local killPlayer = ReplicatedStorage:WaitForChild("killPlayer")
local intermission = ReplicatedStorage:WaitForChild("Intermission")
local teleportPlayers = ReplicatedStorage:WaitForChild("TeleportPlayers")
local tp1 = game.Workspace:FindFirstChild("tp1")
local tp2 = game.Workspace:FindFirstChild("tp2")
local players = game:GetService("Players"):GetPlayers()
while true do
if InLobby.Value == true then
intermission:FireClient()
-- set these values after the for loop, do not need to check i == 0
InLobby.Value = false
InGame.Value = true
elseif InGame.Value == true then
teleportPlayers:FireServer()
for i = 10, 0, -1 do
task.wait(1)
textLabel.Text = "Time remaining: "..i
end
InGame.Value = false
InLobby.Value = true
killPlayer:FireServer()
else
error("Not in lobby or game!") -- errors help debugging
end
end
Basically looking for intermission to run on the client-side. Any help is very appreciated
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local RemoteEvent = ReplicatedStorage:WaitForChild("Intermission")
local TextLabel = StarterGui.ScreenGui:WaitForChild("TextLabel")
RemoteEvent.OnClientEvent:Connect(function(player)
for i = 10, 0, -1 do
task.wait(1)
TextLabel.Text = "Intermission: " .. i
end
end)
When using FireClient(Client), and calling it on the client [ using OnClientEvent] you dont need to provide that player again, it is automatically there! If you want to modify / do something with that player, provide him again as a 2nd argument.
You need to provide a single client here, but doesnt seem that you have one. You could get a single player by looping through all players in game for example.
May I ask why you want the intermission to be on the client? Also, you do not need the player for FireClient(), but you do need to put it in for OnClientEvent(Player, …)
For my round system, I have everything on the server, and I change the value of a StringValue to represent the intermission, in-game, round finished, etc. On the client, if the value is changed, I put the value on the gui. Plus, you have to remember that anything on the client, there is a chance for an exploiter to change that. Also, exploiters can fire remote events willingly.
You do need the Player for FireClient, as you’re firing to a specific user. OnClientEvent does not have the player as the first parameter, only OnServerEvent