Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My Hunger game is not working can you tell me why?

Asked by 11 years ago

So the script says that I need to have a individual map (with spawns) and have it stored in lighting. I also have to have a spawn room with neutral spawns. I have the msg in workshop I also have the starter gui Finally I have a script in work shop and another script in workshop Hung game script: local message = game.Workspace.Msg.Value local Cannon = Script.Cannon local Tick = Script.Tick

battle = false

function onDiedInBattle(humanoid, player) local stats = player:findFirstChild("deaths") if stats ~= nil and battle==true then local deaths = player.deaths deaths.Value = deaths.Value + 1 Cannon:Play() player.Alive.Value = false message(player.Name.." has died, "..#playersStillInBattle.."remain.")

01    local killer = getKillerOfHumanoidIfStillInGame(humanoid)
02 
03    handleKillCount(humanoid, player)
04    local playersStillInBattle = {}
05    for i,child in pairs(game.Players:getChildren()) do
06        if child.Alive.Value then
07            table.insert(playersStillInBattle, child)
08        end
09    end
10    if #playersStillInBattle <= 1 then
11        battle = false
12        nameWinner()
13        killAllPlayers()
14    end
15end

end

function getKillerOfHumanoidIfStillInGame(humanoid) -- returns the player object that killed this humanoid -- returns nil if the killer is no longer in the game

1-- check for kill tag on humanoid - may be more than one - todo: deal with this
2local tag = humanoid:findFirstChild("creator") -- find player with name on tag
3if tag ~= nil then
4    local killer = tag.Value
5    if killer.Parent ~= nil then -- killer still in game
6        return killer
7    end
8end
9return nil

end

function handleKillCount(humanoid, player) local killer = getKillerOfHumanoidIfStillInGame(humanoid) if killer ~= nil then local stats = killer:findFirstChild("kills") if stats ~= nil then local kills = player.kills if killer ~= player then kills.Value = kills.Value + 1 else kills.Value = kills.Value - 1

1        end
2    end
3end

end

function onPlayerEntered(newPlayer) wait()

01local kills = Instance.new("NumberValue")
02kills.Name = "Kills"
03kills.Value = 0
04 
05local deaths = Instance.new("NumberValue")
06deaths.Name = "Deaths"
07deaths.Value = 0
08 
09local wins = Instance.new("NumberValue")
10wins.Name = "Wins"
11wins.Value = 0
12 
13local Alive = Instance.new("BoolValue")
14Alive.Name = "Alive"
15Alive.Value = false
View all 54 lines...

end

game.Players.ChildAdded:connect(onPlayerEntered)

function killAllPlayers() for i, player in pairs(game.Players:getChildren()) do player.Character.Humanoid.Health = 0 player.Alive.Value = false end end

function teleportTributes() Spawns = Map.Spawns:getChildren() for i, player in pairs do wait() S = Spawns[math.random(1, #Spawns)] player.Character.Humanoid.Walkspeed = 0 player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth player.Alive.Value = true for t,y in pairs(Spawns) do if y == E then table.remove(Spawns,t) end end end countdown() end

function countdown() for i = 1, 60 do message(tostring(60 - i)) wait(.5) Tick:Play() end player.Character.Humanoid.Walkspeed = 16 message("Let the Hunger Games begin!") end

function chooseMap() Maps = game.Lighting:getChildren("Maps") for i = 1, #Maps do Map:Clone().Parent = game.Workspace message(Map.Name.." has been selected!") tools = game.Lighting.Tools tools:Clone().Parent = Map tools:MoveTo(Map.Cornucopia:GetCFrame().Position + Vector3.new(0,.3,0)) wait(2) teleportTributes() end end

function beginBattle() for i, player in pairs(game.Players:getChildren()) do if player.Character.Humanoid.Health <= 0 then while true do if player.Character ~= nil then if player.Character.Humanoid.Health >= 0 then break end end wait() end end print(player.Name.." is now ready for battle.") player.Character.Humanoid.Died:connect(function() onDiedInBattle(player.Character.Humanoid, player) end) end end

function nameWinner() local winners = {} function getWinners() for i,player in pairs(game.Players:getChildren()) do if player.Alive.Value then table.insert(winners, player) end end end getWinners() if #winners == 1 then winners[1].leaderstats.Wins.Value = winners[1].leaderstats.Wins.Value + 1 end end if #winners == 1 then message("The winner of The Hunger Games was "..winners[1].Name.."!") elseif #winners == 0 then message("Everyone died in this Hunger Games.") end end

while true do if game.Players.NumPlayers >= 2 then wait(3) message("Welcome to The Hunger Games by [Your Name Here]!") wait(2) message("Transporting all tributes...") teleportTributes() message("Let The Hunger Games begin!", 3) message("The battle will when one winner remains.") wait(.25) battle = true beginBattle() if #winners = 1 then battle = false message("The Hunger Games are now over!") nameWinner() killAllPlayers() else wait(2) message("Two Players are needed for the Games :D or ya cant play") end wait(3.1) end

The time script:

l = game:service("Lighting") while true do -- increment the time of day and then wait for a while l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight()+0.1) wait(0.01) end

Please help me. :D greatly appreciated

1 answer

Log in to vote
0
Answered by 11 years ago

Perhaps in the 1st script, did you define what the name is going to do?

0
Yeah I think so but it is not made by me the script is http://web.roblox.com/item.aspx?setItemId=14504411&avID=233131947 is you want to review it. Scottkid321 5 — 11y
Ad

Answer this question