Hibobb
|
  |
| Joined: 18 Apr 2010 |
| Total Posts: 2146 |
|
|
| 03 Feb 2014 06:23 PM |
How would a gamescript be created? I have a basic idea, this is what i have so far:(NOTE:it doesnt work, still working out kinks)
players = {} assets = {143988441,144652453}
function choosemap() asset = assets[math.random(1,#assets)] return asset end
function guiStart(plr,asset) label = Instance.new("TextLabel",plr.PlayerGui.ScreenGui) label.Size = UDim2.new(1,0,1,0) label.Name = "Game" label.BackgroundColor3 = Color3.new(0,0,0) label.Font = "SourceSansBold" label.TextColor3 = Color3.new(1,1,1) label.FontSize = "Size48" label.ZIndex = 3 for i = 1,5 do label.Text = "Choosing map" wait(.3) label.Text = "Choosing map." wait(.3) label.Text = "Choosing map.." wait(.3) label.Text = "Choosing map..." wait(.3) end map = game:GetService("InsertService"):LoadAsset(asset) map.Name = "Map" map.Parent = Workspace map:MoveTo(Vector3.new(200,200,200)) label.Text = "Map Chosen:"..map.Name.." by "..map.Maker.Value.."" game.Lighting.OutdoorAmbient = Color3.new(map.Ambience.Value) game.Lighting.FogColor = Color3.new(map.FogColor.Value) game.Lighting.FogEnd = map.FogEnd.Value game.Lighting:SetMinutesAfterMidnight(map.Time.Value) --add gamemodes here wait(2.8) label:Destroy() end
function countDown(plr) for i = 120,0,-1 do for i = 0,10 do plr.PlayerGui.GameClock.Time.TextTransparency = i/10 wait(.05) end plr.PlayerGui.GameClock.Time.Text = i for i = 10,0,-1 do plr.PlayerGui.GameClock.Time.TextTransparency = i/10 wait(.05) end end end
function divide() for i,v in pairs(players) do v.TeamColor = BrickColor.Red() end game.Teams:RebalanceTeams() --[[a = true for i,v in pairs(players) do if a then v.TeamColor = BrickColor.new("Bright red") elseif not a then v.TeamColor = BrickColor.new("Bright blue") end end]]-- end
function endGame(player,map) map:Destroy() if Workspace:FindFirstChild("Map") then Workspace.Map:Destroy() end for i,v in pairs(players) do v.Neutral = true end end
function start() while wait() do asset = choosemap() for i,v in pairs(players) do guiStart(v,asset) end divide() for i,v in pairs(players) do countDown(v) end for i,v in pairs(players) do endGame(v,map) end end end
game.Players.PlayerAdded:connect(function(player) player:WaitForChild("PlayerGui") table.insert(players,player) end)
repeat wait() until #players > 1 start()
|
|
|
| Report Abuse |
|
Hibobb
|
  |
| Joined: 18 Apr 2010 |
| Total Posts: 2146 |
|
| |
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 03 Feb 2014 06:56 PM |
| Looks fine. What do you want? |
|
|
| Report Abuse |
|
Hibobb
|
  |
| Joined: 18 Apr 2010 |
| Total Posts: 2146 |
|
|
| 03 Feb 2014 07:05 PM |
| I was wondering if there is a better way to do it. I've seen people use bind able functions but I don't know too much about those |
|
|
| Report Abuse |
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 03 Feb 2014 07:10 PM |
Idk http://wiki.roblox.com/index.php?title=BindableFunction |
|
|
| Report Abuse |
|