leomesa
|
  |
| Joined: 11 Apr 2014 |
| Total Posts: 1029 |
|
|
| 30 Jun 2016 08:33 PM |
Hey I have a round system in which the game starts with Intermission and waits 15 seconds to begin then it sends them to the map. Once there at the map I want them to fight to climb to a certain brick and whoever reaches that brick first wins and then the game restarts back to the lobby. I am having trouble figuring out how to restart the game once the player touches that brick. I have a wait(10) placed in the section where I believe it will go just to test but i'll replace it with the touch event. This is a LocalScript by the way.
local tvalue = script.Parent.StatusTag
lastSpawnPointUsed = 0
lobbySpawn = game.Workspace.Lobby.SpawnLocation Players = game.Players.LocalPlayer StarterWeapon = game.ReplicatedStorage.Weapons.Starter.Pistol TouchBrick = game.ReplicatedStorage.Maps.TheClassicFFA.MainLadders.LadderTop
function beginGame() for i = 15, 0, -1 do wait(1) tvalue.Text = "Intermission: " .. i .. "" if i == 0 then tvalue.Text = "Game Started!" local map = game.ReplicatedStorage.Maps.TheClassicFFA map:Clone().Parent = game.Workspace for i, player in ipairs(game.Players:GetChildren()) do if player.Character ~= nil then lastSpawnPointUsed = lastSpawnPointUsed + 1 player.Character:MoveTo(map.SpawnPoints:GetChildren()[lastSpawnPointUsed].Position) end StarterWeapon:Clone().Parent = Players.Backpack
wait(10) --Where the Touch event will go
tvalue.Text = "Game Over!" for i, player in ipairs(game.Players:GetChildren()) do if player.Character ~= nil then lastSpawnPointUsed = lastSpawnPointUsed + 1 player.Character:MoveTo(lobbySpawn.Position) end Players.Character.Humanoid:UnequipTools() Players.Backpack.Pistol:Destroy() wait(2) beginGame() end
end end end --Ends end
if game.Players.NumPlayers > 0 then beginGame() else tvalue.Text = "Need 2 or more players to begin." end
|
|
|
| Report Abuse |
|
|
leomesa
|
  |
| Joined: 11 Apr 2014 |
| Total Posts: 1029 |
|
| |
|
leomesa
|
  |
| Joined: 11 Apr 2014 |
| Total Posts: 1029 |
|
| |
|
greenmaxy
|
  |
| Joined: 15 Jun 2012 |
| Total Posts: 330 |
|
|
| 30 Jun 2016 09:08 PM |
| Make a touch event in the brick. If you need more help just ask |
|
|
| Report Abuse |
|
|
leomesa
|
  |
| Joined: 11 Apr 2014 |
| Total Posts: 1029 |
|
|
| 30 Jun 2016 09:14 PM |
| I could but i'm using a localscript so I won't be able to access the event. |
|
|
| Report Abuse |
|
|
greenmaxy
|
  |
| Joined: 15 Jun 2012 |
| Total Posts: 330 |
|
|
| 30 Jun 2016 09:40 PM |
Try making a variable (string) that changes when the player touches the brick (string is in map or something). It changes the value when touched (To the players name) Then do local numberofplayers = game.Players:GetChildren()
for i = 1, #numberofplayers do Then kill the players that don't have the name as the value
end
I didn't check it over... |
|
|
| Report Abuse |
|
|
leomesa
|
  |
| Joined: 11 Apr 2014 |
| Total Posts: 1029 |
|
| |
|