Printing a variable with text

Basically I have an intermission to my game and i, represents how many seconds are left.
I used a remote event to send that info to a local script, and the local script will make a gui say (“game starts in i seconds”). But I have no idea what to type to make the print say what the variable i holds and not just i.

Ik this is a pretty dumb thing to ask, but for the life of me I cannot find out how to do this anywhere.

Server script:

Local Script

It should be:

local playerGui = game.Players.LocalPlayer.PlayerGui
RS.OnClientEvent:Connect(function(i: number) -- we need `i` as passed argument by the server || the ":number" is just a type syntax
   playerGui.ScreenGui.Textlabel.Text = `Game will start in {i} second{(i > 1 and "s") or ""}`
end)

In here.


the if == 10 then just move them out of the for loop:

for i = 1, 10 do
   --...
end
--removed unnecessary `if i == 10 then`
for _, player in (game.Players:GetPlayers()) do
   --...
1 Like

it worked but it also works without all this {(i > 1 and “s”) or “”}
why did you add that?

Uh its for if i is more than 1 then it adds “s” for “seconds”

If it’s more than 1 then it’s “seconds” but if it’s 1, then 1 “second”. Just grammar.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.