Server Script

local replicated = game:GetService("ReplicatedStorage")
local remotefunction = replicated:FindFirstChild("RemoteEvent")
local remotefunction2 = replicated:FindFirstChild("RemoteEvent2")
local remotefunction3 = replicated:FindFirstChild("RemoteEvent3")


remotefunction2:FireAllClients()
 
remotefunction.OnServerEvent:Connect(function(player)
  local character = player.Character
  local Hum = character.HumanoidRootPart

  local brick1 = game.Workspace:WaitForChild("spawn1")
  local brick2 = game.Workspace:WaitForChild("spawn2")
  local brick3 = game.Workspace:WaitForChild("spawn3")


 local ans = math.random(1,3)

  if ans == 1 then
      Hum.Position = brick1.Position
  elseif ans ==2 then
	  Hum.Position = brick2.Position
  elseif ans==3 then
	  Hum.Position = brick3.Position
 end

  remotefunction:FireAllClients()

end)

remotefunction3.OnServerEvent:Connect(function(player)
  local character = player.Character
  local Hum = character.HumanoidRootPart

  local brick3 = game.Workspace:WaitForChild("spawn4")
  local brick4 = game.Workspace:WaitForChild("spawn5")
  local brick5 = game.Workspace:WaitForChild("spawn6")


 local ans = math.random(1,3)

  if ans == 1 then
      Hum.Position = brick3.Position
  elseif ans ==2 then
	  Hum.Position = brick4.Position
  elseif ans==3 then
	  Hum.Position = brick5.Position
 end

 remotefunction2:FireAllClients()

end)

Local Script

local replicated = game:GetService("ReplicatedStorage")
local remotefunction = replicated:FindFirstChild("RemoteEvent")
local remotefunction2 = replicated:FindFirstChild("RemoteEvent2")
local remotefunction3 = replicated:FindFirstChild("RemoteEvent3")

remotefunction2.OnClientEvent:Connect(function()
 print("yo")
 script.Parent.Text = "5"
 wait(1)
 script.Parent.Text = "4"
 wait(1)
 script.Parent.Text = "3"
 wait(1)
 script.Parent.Text = "2"
 wait(1)
 script.Parent.Text = "1"
 wait(1)
 script.Parent.Text = "Get Ready!"
 wait(1)
 remotefunction:FireServer()
 wait(1)
 script.Parent.Text = "Round Started!"
end)

remotefunction.OnClientEvent:Connect(function()
  local dr = 0
 repeat until dr == 120 
  local drx = 120 - dr
  script.Parent.Text = "Game in progress:"..drx
  dr = dr + 1
  wait(1)
 if dr == 120 then
  remotefunction3:FireServer()
 end
end)

Im not getting any errors for the gui not working. It just isn't working.

This is how it works:

-Server sends to all clients to countdown

-Client sends to server to teleport

-Server sends to call clients to change game timer

-All clients send to the server to teleport back

-Server sends to all clients to countdown again

If you spot anything please tell me!

2 comments

0

Hi im not that great at scripting but i think the part where "dr = dr + 1" is in the wrong position. I think its suppose to be next to the "local dr p= 0"

0

"local dr = 0"