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: Is there anything wrong with this?

Previous Thread :: Next Thread 
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 04:58 PM
I would love to test it, but whenever I try it won't respond ): Could someone tell me if they see any errors here?
Thanks :D

    while true do

    if game.Players.NumPlayers ​>= 1 then
        local hin = Instance.new("Hint")
        hin.Text = "Choosing it."
        hin.Text = "Choosing it.."
        hin.Text = "Choosing it..."
        local it = math.random(game.Players:GetChildren())
        hin.Text = "It is..."
        hin.Text = it.Name.."!"
        hin.Text = "Choosing map."
        hin.Text = "Choosing map.."
        hin.Text = "Choosing map..."
        hin.Text = "Map is..."
        local map = math.random(game.Lighting.Maps:GetChildren())
        hin.Text = map.Name.."!"
        for _,v in pairs(game.Players:GetPlayers())do
            if v.Name ~= it.Name then
            v.Character:MoveTo(Vector3.new(map.Spawn.Position))
            end
        end
    hin.Text = "Teleporting Players.."
    wait(.5)
    hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    game.Workspace.Clock1.Disabled = false
    wait(90)
    game.Workspace.Clock1.Disabled = true
    hin.Text = "Time up! The it will now start looking!"
    it.Character:MoveTo(Vector3.new(map.Spawn.Position))
    game.Lighting.itscript:clone().Parent = it.Character
    hin.Text = "Time left for it to find players "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    game.Workspace.Clock2.Disabled = false
    wait(210)
    game.Workspace.Clock2.Disabled = true
    for _,v in pairs(game.Players:GetPlayers())do
        if v.Character:FindFirstChild("Tagged") == nil then
            local leader = v:FindFirstChild("leaderstat")
            local points = leader:FindFirstChild("Points")
            points.Value = points.Value + 7
            v.Character:BreakJoints()
        elseif v.Character:FindFirstChild("Tagged") ~= nil then
            local tag = v.Character:FindFirstChild("Tagged")
            tag:Destroy()
        end
    end
    it.Character.itscript:Destroy()
    hin.Text = "The round has ended! Please wait for the next game!"
    hin:Destroy()
    end
end
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
06 Jan 2012 05:14 PM
The reason it doesnt respond is because it's going into an infinite loop. You have all the waits inside the if statement, so if game.Players.NumPlayers ​>= 1 returns false, it will stall your game. :D
Solution:
Add a wait that is outside the if. (or in an "else")
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Jan 2012 05:14 PM
I didn't look at that whole thing but you never parented hint...Well, I couldn't find it.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 05:16 PM
oh thanks :p
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Jan 2012 05:24 PM
Wait, did you parent it? I couldn't find it so I thought that was your problem.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 05:25 PM
I fixed most of the problems but now I'm confused with ends, the output is very confusing some times.
Here is my Improved script :D

    while true do

    if game.Players.NumPlayers ​>= 1 then
        hint:Destroy()
        local hin = Instance.new("Hint")
        hin.Parent = game.Workspace
        hin.Text = "Choosing it."
        hin.Text = "Choosing it.."
        hin.Text = "Choosing it..."
        local P = game.Players:GetChildren()
        for i=1, 1 do
        local it = P[math.random(1,#P)]
        hin.Text = "It is..."
        hin.Text = it.Name.."!"
        hin.Text = "Choosing map."
        hin.Text = "Choosing map.."
        hin.Text = "Choosing map..."
        hin.Text = "Map is..."
        local map = math.random(game.Lighting.Maps:GetChildren())
        hin.Text = map.Name.."!"
        for _,v in pairs(game.Players:GetPlayers())do
            if v.Name ~= it.Name then
            v.Character:MoveTo(Vector3.new(map.Spawn.Position))
            v.Character.Head.Transparency = 1
            end
        end
    hin.Text = "Teleporting Players.."
    wait(.5)
    for s = 30,0,-1 do
        game.Workspace.sec.Value = s
        wait(1)
        hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    end
    game.Workspace.min.Value = 0
    hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    for p = 59,0,-1 do
        game.Workspace.sec.Value = p
        wait(1)
        hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    end
    hin.Text = "Time up! The it will now start looking!"
    it.Character:MoveTo(Vector3.new(map.Spawn.Position))
    game.Lighting.itscript:clone().Parent = it.Character
    hin.Text = "Time left for it to find players "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    game.Workspace.min.Value = 3
    hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    for s = 30,0,-1 do
        game.Workspace.sec.Value = s
        wait(1)
        hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    end
    game.Workspace.min.Value = 2
    hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    for p = 59,0,-1 do
        game.Workspace.sec.Value = p
        wait(1)
        hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    end
    game.Workspace.min.Value = 1
    hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    for h = 59,0,-1 do
        game.Workspace.sec.Value = h
        wait(1)
        hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    end
    game.Workspace.min.Value = 0
    hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    for g = 59,0,-1 do
        game.Workspace.sec.Value = g
        wait(1)
        hin.Text = "Time left to hide "..game.Workspace.min.Value..":"..game.Workspace.sec.Value
    end

    for _,v in pairs(game.Players:GetPlayers())do
        if v.Character:FindFirstChild("Tagged") == nil then
            local leader = v:FindFirstChild("leaderstats")
            local points = leader:FindFirstChild("Points")
            points.Value = points.Value + 7
            v.Character:BreakJoints()
        elseif v.Character:FindFirstChild("Tagged") ~= nil then
            local tag = v.Character:FindFirstChild("Tagged")
            tag:Destroy()
            v.Character.Head.Transparency = 0
        end
    end
    it.Character.itscript:Destroy()
    hin.Text = "The round has ended! Please wait for the next game!"
    hin:Destroy()
    end
    end
    end
    else
        local hint = Instance.new("Hint")
        hint.Parent = game.Workspace
        hint.Text = "1 more Player is needed to start the game."
end



Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
06 Jan 2012 05:26 PM
Well what does the output say?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Jan 2012 05:26 PM
Bro, I AM NOT READING THAT WHOLE SCRIPT :P

Say the output instead.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 05:27 PM
It says game.Workspace.Script:92 <​eof> expected near "else"
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 05:28 PM
It didn't show the part after 92 :O
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Jan 2012 05:29 PM
Show us line 92.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 05:29 PM
        else
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
06 Jan 2012 05:30 PM
well looking at it, you have too many ends.
And why do you have this here:
for i=1, 1 do


Here's a little reference. You need "1 end for these keywords (and prolly others i missed):
do
function
then

In the scripting window in Studio, there are little blue dashes by the line numbers. You need 1 end for every one of those dashes.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 05:31 PM
@Dr, I know that, I had that amount of dashes, but it said "end expected to close while at line 1"
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Jan 2012 05:32 PM
That means you didn't end for your while loop.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 05:33 PM
But I did D: And when I add another end it says what I posted earlier...
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Jan 2012 05:35 PM
Remove an end and what does the output say...I'm sorry, that script is just too long too read.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 05:40 PM
@miz, it says "end expected to close while at line 1"
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Jan 2012 05:45 PM
I'm sorry. I'm not gonna help because too long of a script.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
06 Jan 2012 06:09 PM
It's ok, thanks for trying :)
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