generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Another Fixing Problem Sorry ;c

Previous Thread :: Next Thread 
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
08 Dec 2013 03:12 PM
In My Script (Thanks To The Last User Who Helped Fix Part Of It) Near The End I cannot Figure Out The Problem Sorry Im Only Basic At Scripting Still Learning.


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")
end
wait(5.1)
end

~Fight For The D.U.S.E Alliance Today!~Is An ATRer~
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
08 Dec 2013 03:13 PM
Do Not Talk Like This.
Lern2gremmer
Report Abuse
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
08 Dec 2013 03:15 PM
Can't you just help instead of critise.

~Fight For The D.U.S.E Alliance Today!~Is An ATRer~
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
08 Dec 2013 03:15 PM
if #winners == 1 then

I'm ignoring the extra end because I'm assuming its part of a while loop.
Report Abuse
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
08 Dec 2013 03:17 PM
@wazap

Thanks That Fixed That But Now More Problems Are Accuring I Think The Script Needs Fixing Could You Point Out The Broken parts And How To Fix It? Thanks.


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.")

local killer = getKillerOfHumanoidIfStillInGame(humanoid)

handleKillCount(humanoid, player)
local playersStillInBattle = {}
for i,child in pairs(game.Players:getChildren()) do
if child.Alive.Value then
table.insert(playersStillInBattle, child)
end
end
if #playersStillInBattle <= 1 then
battle = false
nameWinner()
killAllPlayers()
end
end
end

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

-- check for kill tag on humanoid - may be more than one - todo: deal with this
local tag = humanoid:findFirstChild("creator") -- find player with name on tag
if tag ~= nil then
local killer = tag.Value
if killer.Parent ~= nil then -- killer still in game
return killer
end
end
return 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

end
end
end
end


function onPlayerEntered(newPlayer)
wait()

local kills = Instance.new("NumberValue")
kills.Name = "Kills"
kills.Value = 0

local deaths = Instance.new("NumberValue")
deaths.Name = "Deaths"
deaths.Value = 0

local wins = Instance.new("NumberValue")
wins.Name = "Wins"
wins.Value = 0

local Alive = Instance.new("BoolValue")
Alive.Name = "Alive"
Alive.Value = false

while true do
if newPlayer.Character ~= nil then break end
wait(5)
end

newPlayer.Changed:connect()
newPlayer.CharacterAdded:connect(function(char)--Code Starts To Brake Here.
if not newPlayer.Alive.Value then
print("Player spawned, removing tools")
for i,tool in pairs(newPlayer.Backpack:children())do
if tool:IsA("Tool")or tool:IsA("HopperBin")then
tool:remove()
end
end
end
end)

if newPlayer:findFirstChild("leaderstats") == nil then
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
kills.Parent = stats
deaths.Parent = stats
wins.Parent = stats
stats.Parent = newPlayer
Alive.Parent = newPlayer
else
kills.Parent = newPlayer
deaths.Parent = newPlayer
end

newPlayer.Alive.Value = false

for i,tool in pairs(newPlayer.Backpack:getChildren()) do
if tool.className == "Tool" or tool.className == "HopperBin" then
tool:remove()
end
end
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

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")
end
wait(5.1)
end

~Fight For The D.U.S.E Alliance Today!~Is An ATRer~
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
08 Dec 2013 03:17 PM
Nope, Typing Like This Is Very Inefficient And Shows That You Don`t Know When To Capitalize Thing So To Avoid Looking Like An Idiot You Make Yourself Look Like An Even Bigger Idiot.
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
08 Dec 2013 03:18 PM
Could you narrow it down or at least give the output? I'm not looking through all of that..
Report Abuse
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
08 Dec 2013 03:24 PM
It Won't Let Me Post The Output It Says Unexpected Error
Report Abuse
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
08 Dec 2013 03:26 PM

Heres The Recent Error.

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")
end
wait(5.1)
end
~Fight For The D.U.S.E Alliance Today!~Is An ATRer~
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
08 Dec 2013 03:27 PM
Either way I'm not looking through all of that... Try narrowing it down to about 30 lines...
Report Abuse
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
08 Dec 2013 03:28 PM
while true do
if game.Players.NumPlayers >= 2 then

~Fight For The D.U.S.E Alliance Today!~Is An ATRer~
Report Abuse
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
08 Dec 2013 03:41 PM
such a pain

~Fight For The D.U.S.E Alliance Today!~Is An ATRer~
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
08 Dec 2013 03:50 PM
missing an "end"
Report Abuse
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
09 Dec 2013 05:53 AM
Ok But Would That Stop The Script Or Continue.

~Fight For The D.U.S.E Alliance Today!~Is An ATRer~
Report Abuse
buzzbee247 is not online. buzzbee247
Joined: 23 Mar 2012
Total Posts: 3292
09 Dec 2013 06:12 AM
The "End" Stoped The Script Didn't Work.

~Fight For The D.U.S.E Alliance Today!~Is An ATRer~
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image