Roblox Central

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Roblox Central

Discussion for all things Roblox. (roblox.com)

Welcome to the new forum! Any suggestions you have are greatly appreciated.
WARNING: Before referring anyone to this website, Please read this topic

4 posters

    Errors and no output

    iMathRandom
    iMathRandom
    Mod


    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Errors and no output Empty Errors and no output

    Post by iMathRandom Sun Jun 21, 2009 10:59 pm

    Code:
    local ting = false
    function Start()
    if ting == false then
    ting = true
    _G.yellow = 0
    local Point1 = Vector3.new(89, 26.6, 3)
    local Point2 = Vector3.new(38, 26.6, 3)
    function Move(TeamColor)
    local plyrs = {}
    for i,v in ipairs(game.Players:GetChildren())do
    if(v.TeamColor == "Bright yellow")then
    yellow = yellow + 1
    if yellow == 2 then
    if(pcall(function() assert(v.Character.Torso) end))then
    table.insert(plyrs,v)
    end
    end
    end
    local rand1 = math.random(#plyrs)
    local choice1 = plyrs[rand1]
    table.remove(plyrs,rand1)
    local choice2 = plyrs[math.random(#plyrs)]
    local msg = Instance.new("Message")
    msg.Parent = game.Workspace
    msg.Text = "The game will now begin."
    wait(2)
    msg.Text = "The players are ... "..choice1.Character.Name.." and "..choice2.Character.Name.."."
    wait(4)
    msg.Text = "Get Ready!"
    wait(3)
    choice1.Character.Torso.CFrame = CFrame.new(Point1)
    choice2.Character.Torso.CFrame = CFrame.new(Point2)
    msg.Text = "GO!"
    msg:Remove()
    local Hintimer = Instance.new("Hint")
    Hintimer.Parent = game.Workspace
    _G.timer1 = 2
    _G.timer2 = 0
    _G.timer3 = 0
    while true do
    Hintimer.Text = timer3..":" ..timer2 ..timer1
    wait(1)
    while timer3 == 0 do
    timer2 = timer2 - 1
    wait(1)
    end
    while timer2 == 0 do
    timer1 = timer1 -1
    if timer1 == 0 then
    Hintimer.Text = "GAME OVER!!!"
    msg3 = Instance.new("Message")
    msg3.Parent = game.Workspace
    if choice1.leaderstats.Orbs.Value > choice2.leaderstats.Orbs.Value then
    msg3.Text = string.upper(choice1.Character.Name.."wins!!!")
    choice1.leaderstats.Wins.Value = choice1.leaderstats.Wins.Value + 1
    msg3:Remove()
    choice1.Character:BreakJoints()
    choice2.Character:BreakJoints()
    elseif choice2.leaderstats.Orbs.Value > choice1.leaderstats.Orbs.Value then
    msg3.Text = string.upper(choice2.Character.Name.."wins!!!")
    choice2.leaderstats.Wins.Value = choice2.leaderstats.Wins.Value + 1
    msg3:Remove()
    choice1.Character:BreakJoints()
    choice2.Character:BreakJoints()
    else
    msg3.Text = "Tie!"
    msg3:Remove()
    end
    end
    end
    end
    end
    if choice1.leaderstats.Orbs.Value == 200 then
    choice1.leaderstats.Wins.Value = choice1.leaderstats.Wins.Value + 1
    msg1 = Instance.new("Message")
    msg1.Parent = game.Workspace
    msg1.Text = string.upper(choice1.Character.Name.."wins!!!")
    choice1.Character:BreakJoints()
    choice2.Character:BreakJoints()
    elseif choice2.leaderstats.Orbs.Value == 200 then
    choice2.leaderstats.Wins.Value = choice2.leaderstats.Wins.Value + 1
    msg2 = Instance.new("Message")
    msg2.Parent = game.Workspace
    msg2.Text = string.upper(choice2.Character.Name.."wins!!!")
    choice1.Character:BreakJoints()
    choice2.Character:BreakJoints()
    ting = false
    end
    end
    end
    end
    while ting == true do
    Start()
    wait()
    end
    Earth
    Earth
    Admin


    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Errors and no output Empty Re: Errors and no output

    Post by Earth Mon Jun 22, 2009 7:58 am

    Did you make that?

    Why do you need global timers and pcall?
    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Errors and no output Empty Re: Errors and no output

    Post by Jfeather Mon Jun 22, 2009 9:09 am

    It looks like a game-running script.
    iMathRandom
    iMathRandom
    Mod


    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Errors and no output Empty Re: Errors and no output

    Post by iMathRandom Mon Jun 22, 2009 1:18 pm

    I had no Idea what "_G." was. If that is what the problem is, can you fix it?
    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Errors and no output Empty Re: Errors and no output

    Post by Jfeather Mon Jun 22, 2009 2:45 pm

    ....That's why I always make my own scripts. It looks like the variable _G was never assigned in that script, ruining the whole thing...?

    What were you trying to make, anyway?
    Earth
    Earth
    Admin


    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Errors and no output Empty Re: Errors and no output

    Post by Earth Mon Jun 22, 2009 3:11 pm

    Re write it without pcall and _G

    Then see if it works.
    iMathRandom
    iMathRandom
    Mod


    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Errors and no output Empty Re: Errors and no output

    Post by iMathRandom Mon Jun 22, 2009 3:16 pm

    @ Jf,
    I did make it myself and Have you ever played Kingdom Hearts II
    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Errors and no output Empty Re: Errors and no output

    Post by Jfeather Mon Jun 22, 2009 8:48 pm

    No, I have not.

    Not to be offencive, but if you made the script, you should know what everything inside it is, and what it does. If you don't know what something does/is, you might as well remove it. This doesn't mean the script will still work, though Wink
    Earth
    Earth
    Admin


    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Errors and no output Empty Re: Errors and no output

    Post by Earth Tue Jun 23, 2009 6:47 am

    Don't over complicate things.


    Only Meelo can do that.
    iMathRandom
    iMathRandom
    Mod


    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Errors and no output Empty Re: Errors and no output

    Post by iMathRandom Tue Jun 23, 2009 10:04 am

    skip to 2:00


    I was asked to script that for a firend, I was getting help on roblox's forum when ppl told me to use _G. for teams. I didn't know it wouldn't work with everything Crying or Very sad . Meelo did the pcall part.

    EDIT:
    I've redid it
    Code:
    function Start()
    _G.yellow = 0
    local Point1 = Vector3.new(89, 26.6, 3)
    local Point2 = Vector3.new(38, 26.6, 3)
    function Move(TeamColor)
    local plyrs = {}
    for i,v in ipairs(game.Players:GetChildren())do
    if(v.TeamColor == "Bright yellow")then
    yellow = yellow + 1
    if yellow == 2 then
    if(pcall(function() assert(v.Character.Torso) end))then
    table.insert(plyrs,v)
    end
    end
    end
    local rand1 = math.random(#plyrs)
    local choice1 = plyrs[rand1]
    table.remove(plyrs,rand1)
    local choice2 = plyrs[math.random(#plyrs)]
    local msg = Instance.new("Message")
    msg.Parent = game.Workspace
    msg.Text = "The game will now begin."
    wait(2)
    msg.Text = "The players are ... "..choice1.Character.Name.." and "..choice2.Character.Name.."."
    wait(4)
    msg.Text = "Get Ready!"
    wait(3)
    choice1.Character.Torso.CFrame = CFrame.new(Point1)
    choice2.Character.Torso.CFrame = CFrame.new(Point2)
    msg.Text = "GO!"
    msg:Remove()
    local hint = Instance.new("Hint")
    hint.Parent = game.Workspace
    local set.Name = hint.Text
    set.Name = "Get Ready!"
    wait(5)
    set.Name = "BEGGIN!!!"
    wait(1)
    set.Name = "2:00"
    wait(1)
    set.Name = "1:59"
    wait(1)
    set.Name = "1:58"
    wait(1)
    set.Name = "1:57"
    wait(1)
    set.Name = "1:56"
    wait(1)
    set.Name = "1:55"
    wait(1)
    set.Name = "1:54"
    wait(1)
    set.Name = "1:53"
    wait(1)
    set.Name = "1:52"
    wait(1)
    set.Name = "1:51"
    wait(1)
    set.Name = "1:50"
    wait(1)
    set.Name = "1:49"
    wait(1)
    set.Name = "1:48"
    wait(1)
    set.Name = "1:47"
    wait(1)
    set.Name = "1:46"
    wait(1)
    set.Name = "1:45"
    wait(1)
    set.Name = "1:44"
    wait(1)
    set.Name = "1:43"
    wait(1)
    set.Name = "1:42"
    wait(1)
    set.Name = "1:41"
    wait(1)
    set.Name = "1:40"
    wait(1)
    set.Name = "1:39"
    wait(1)
    set.Name = "1:38"
    wait(1)
    set.Name = "1:37"
    wait(1)
    set.Name = "1:36"
    wait(1)
    set.Name = "1:35"
    wait(1)
    set.Name = "1:34"
    wait(1)
    set.Name = "1:33"
    wait(1)
    set.Name = "1:32"
    wait(1)
    set.Name = "1:31"
    wait(1)
    set.Name = "1:30"
    wait(1)
    set.Name = "1:29"
    wait(1)
    set.Name = "1:28"
    wait(1)
    set.Name = "1:27"
    wait(1)
    set.Name = "1:26"
    wait(1)
    set.Name = "1:25"
    wait(1)
    set.Name = "1:24"
    wait(1)
    set.Name = "1:23"
    wait(1)
    set.Name = "1:22"
    wait(1)
    set.Name = "1:21"
    wait(1)
    set.Name = "1:20"
    wait(1)
    set.Name = "1:19"
    wait(1)
    set.Name = "1:18"
    wait(1)
    set.Name = "1:17"
    wait(1)
    set.Name = "1:16"
    wait(1)
    set.Name = "1:15"
    wait(1)
    set.Name = "1:14"
    wait(1)
    set.Name = "1:13"
    wait(1)
    set.Name = "1:12"
    wait(1)
    set.Name = "1:11"
    wait(1)
    set.Name = "1:10"
    wait(1)
    set.Name = "1:09"
    wait(1)
    set.Name = "1:08"
    wait(1)
    set.Name = "1:07"
    wait(1)
    set.Name = "1:06"
    wait(1)
    set.Name = "1:05"
    wait(1)
    set.Name = "1:04"
    wait(1)
    set.Name = "1:03"
    wait(1)
    set.Name = "1:02"
    wait(1)
    set.Name = "1:01"
    wait(1)
    set.Name = "1:00"
    wait(1)
    set.Name = "0:59"
    wait(1)
    set.Name = "0:58"
    wait(1)
    set.Name = "0:57"
    wait(1)
    set.Name = "0:56"
    wait(1)
    set.Name = "0:55"
    wait(1)
    set.Name = "0:54"
    wait(1)
    set.Name = "0:53"
    wait(1)
    set.Name = "0:52"
    wait(1)
    set.Name = "0:51"
    wait(1)
    set.Name = "0:50"
    wait(1)
    set.Name = "0:49"
    wait(1)
    set.Name = "0:48"
    wait(1)
    set.Name = "0:47"
    wait(1)
    set.Name = "0:46"
    wait(1)
    set.Name = "0:45"
    wait(1)
    set.Name = "0:44"
    wait(1)
    set.Name = "0:43"
    wait(1)
    set.Name = "0:42"
    wait(1)
    set.Name = "0:41"
    wait(1)
    set.Name = "0:40"
    wait(1)
    set.Name = "0:39"
    wait(1)
    set.Name = "0:38"
    wait(1)
    set.Name = "0:37"
    wait(1)
    set.Name = "0:36"
    wait(1)
    set.Name = "0:35"
    wait(1)
    set.Name = "0:34"
    wait(1)
    set.Name = "0:33"
    wait(1)
    set.Name = "0:32"
    wait(1)
    set.Name = "0:31"
    wait(1)
    set.Name = "0:30"
    wait(1)
    set.Name = "0:29"
    wait(1)
    set.Name = "0:28"
    wait(1)
    set.Name = "0:27"
    wait(1)
    set.Name = "0:26"
    wait(1)
    set.Name = "0:25"
    wait(1)
    set.Name = "0:24"
    wait(1)
    set.Name = "0:23"
    wait(1)
    set.Name = "0:22"
    wait(1)
    set.Name = "0:21"
    wait(1)
    set.Name = "0:20"
    wait(1)
    set.Name = "0:19"
    wait(1)
    set.Name = "0:18"
    wait(1)
    set.Name = "0:17"
    wait(1)
    set.Name = "0:16"
    wait(1)
    set.Name = "0:15"
    wait(1)
    set.Name = "0:14"
    wait(1)
    set.Name = "0:13"
    wait(1)
    set.Name = "0:12"
    wait(1)
    set.Name = "0:11"
    wait(1)
    set.Name = "0:10"
    wait(1)
    set.Name = "0:09"
    wait(1)
    set.Name = "0:08"
    wait(1)
    set.Name = "0:07"
    wait(1)
    set.Name = "0:06"
    wait(1)
    set.Name = "0:05"
    wait(1)
    set.Name = "0:04"
    wait(1)
    set.Name = "0:03"
    wait(1)
    set.Name = "0:02"
    wait(1)
    set.Name = "0:01"
    wait(1)
    set.Name = "END OF MATCH!"
    wait(2)
    msg3 = Instance.new("Message")
    msg3.Parent = game.Workspace
    end
    if choice1.leaderstats.Orbs.Value > choice2.leaderstats.Orbs.Value then
    msg3.Text = string.upper(choice1.Character.Name.."wins!!!")
    choice1.leaderstats.Wins.Value = choice1.leaderstats.Wins.Value + 1
    msg3:Remove()
    choice1.Character:BreakJoints()
    choice2.Character:BreakJoints()
    elseif choice2.leaderstats.Orbs.Value > choice1.leaderstats.Orbs.Value then
    msg3.Text = string.upper(choice2.Character.Name.."wins!!!")
    choice2.leaderstats.Wins.Value = choice2.leaderstats.Wins.Value + 1
    msg3:Remove()
    choice1.Character:BreakJoints()
    choice2.Character:BreakJoints()
    else
    msg3.Text = "Tie!"
    msg3:Remove()
    end
    if choice1.leaderstats.Orbs.Value == 200 then
    choice1.leaderstats.Wins.Value = choice1.leaderstats.Wins.Value + 1
    msg1 = Instance.new("Message")
    msg1.Parent = game.Workspace
    msg1.Text = string.upper(choice1.Character.Name.."wins!!!")
    choice1.Character:BreakJoints()
    choice2.Character:BreakJoints()
    elseif choice2.leaderstats.Orbs.Value == 200 then
    choice2.leaderstats.Wins.Value = choice2.leaderstats.Wins.Value + 1
    msg2 = Instance.new("Message")
    msg2.Parent = game.Workspace
    msg2.Text = string.upper(choice2.Character.Name.."wins!!!")
    choice1.Character:BreakJoints()
    choice2.Character:BreakJoints()
    end
    end
    end
    iMathRandom
    iMathRandom
    Mod


    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Errors and no output Empty Re: Errors and no output

    Post by iMathRandom Wed Jun 24, 2009 2:25 pm

    Theres a script that goes with it that Im not getting an output on
    http://www.roblox.com/Forum/ShowPost.aspx?PostID=10092949#10127212
    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Errors and no output Empty Re: Errors and no output

    Post by Jfeather Thu Jun 25, 2009 9:57 am

    NOTE: I'm talking about the script on post 10.


    Hmm.. first off, You don't say what _G is, but you act like you're finding something within _G.

    Right here:
    Code:
    _G.yellow = 0

    If you're using a variable inside the script, just use G = 0. If you're not, i.e. you're finding something outside the script, you're going to need to tell the script what you're looking for (_G = game.Workspace.whatever.whatever), THEN assign it's value.




    Also, am I missing something, or are you missing the end for the the Start() function?


    Also, You start the whole script with a function. Is there anything inside the code that isn't inside any function? If not, at the very very end, after everything, add
    Code:
    Start() OR MovePlayers(Teamcolorhere)
    so it actually runs the function for you. (Functions don't run unless you tell them to!)

    I might be totally wrong, but that's all I can think of... hopefully it helps somehow.


    Last edited by Jfeather on Thu Jun 25, 2009 7:49 pm; edited 2 times in total
    Earth
    Earth
    Admin


    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Errors and no output Empty Re: Errors and no output

    Post by Earth Thu Jun 25, 2009 11:41 am

    Totally wrong about _G

    _G.yellow = 1

    is valid.
    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Errors and no output Empty Re: Errors and no output

    Post by Jfeather Thu Jun 25, 2009 2:15 pm

    What is _G? I think I'm over my head here. Anyway, I fixed my previous post.
    Earth
    Earth
    Admin


    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Errors and no output Empty Re: Errors and no output

    Post by Earth Thu Jun 25, 2009 3:02 pm

    global stuff

    EG in one script

    [[

    _G.EPIC = "Earth100"

    ]]

    in another...

    [[
    wait() -- needs to store global value
    print(EPIC)

    ]]

    output: Earth100
    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Errors and no output Empty Re: Errors and no output

    Post by Jfeather Thu Jun 25, 2009 7:49 pm

    Oh. I was totally unaware of that feature... that could be pretty useful.
    Earth
    Earth
    Admin


    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Errors and no output Empty Re: Errors and no output

    Post by Earth Fri Jun 26, 2009 1:56 pm

    But it causes a bit more lag then normal

    But if you redefine it

    local Epic = Epic

    then that fixes it
    iMathRandom
    iMathRandom
    Mod


    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Errors and no output Empty Re: Errors and no output

    Post by iMathRandom Mon Jun 29, 2009 1:33 pm

    I'll look over it more carfully.
    Kaleb12
    Kaleb12
    New
    New


    Posts : 10
    Join date : 2009-08-07

    Errors and no output Empty Re: Errors and no output

    Post by Kaleb12 Sun Aug 09, 2009 5:07 pm

    Thanks Earth. Now I don't have to find out what Globals are from the wiki.

    Sponsored content


    Errors and no output Empty Re: Errors and no output

    Post by Sponsored content


      Current date/time is Mon May 20, 2024 4:14 am