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: I'm so confused...

Previous Thread :: Next Thread 
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 11:31 AM
There is something wrong with the ends, but I'm sure I have the right amount. The output tells me to add 1 and then take it away...
Any help?

    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()
        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
    else
        local hint = Instance.new("Hint")
        hint.Parent = game.Workspace
        hint.Text = "1 more Player is needed to start the game."
    end


I know it is very long, sorry.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 04:52 PM
bump :o
Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
07 Jan 2012 05:01 PM
What line does the output tell you to add an end?
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 05:15 PM
At, else.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 05:33 PM
This is annoying because I can't test to see if there are any other errors ):
Should the end be in a different spot?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jan 2012 05:47 PM
The last 5 lines.


You have:


end
else
local hint = Instance.new("Hint")
hint.Parent = game.Workspace
hint.Text = "1 more Player is needed to start the game."
end



Should be:



    else
        local hint = Instance.new("Hint")
        hint.Parent = game.Workspace
        hint.Text = "1 more Player is needed to start the game."
    end
    end


Cheers,
-- AFF

~ 121/97/103 109/97 105
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jan 2012 05:48 PM
Last 6 lines... **

>_>


Cheers,
-- AFF

~ 121/97/103 109/97 105
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 06:13 PM
Now it doesn't respond when I try to test ):
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
07 Jan 2012 06:30 PM
It's strange how it showed up a ? mark here:
if game.Players.NumPlayers ?>= 1 then
when I pasted it in a script.

On Line 4, there is hint:Destroy(). The tag 'hint' hasn't come yet until later in the script.

Also, the part where Agent is talking.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 06:32 PM
@Ro, I removed the hint:Destroy(), but it still wont work ):
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jan 2012 06:52 PM
Grove, add a wait() right after 'while true do' in your script.


Cheers,
-- AFF

~ 121/97/103 109/97 105
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
07 Jan 2012 06:53 PM
local h = {"Choosing it.","Choosing it..","Choosing it..."}
local m = {"Choosing map.","Choosing map..","Choosing map..."}
while true do
if game.Players.NumPlayers >= 1 then
local hin = Instance.new("Hint")
hin.Parent = game.Workspace
for i=1,#h do
hin.Text = h[i]
wait(0.1)
end
local P = game.Players:GetChildren()
local it = P[math.random(1,#P)]
hin.Text = "It is..."
hin.Text = it.Name.."!"
for i=1,#m do
hin.Text = m[i]
wait(0.1)
end
hin.Text = "Map is..."
local mappp = game.Lighting.Map:GetChildren()
local mapp = mappp[math.random(1,#mappp)]
local map = mapp:clone()
map.Parent = workspace
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()
else
local hint = Instance.new("Hint")
hint.Parent = game.Workspace
hint.Text = "1 more Player is needed to start the game."
end end
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 06:57 PM
It still didn't respond when I tried to test ):
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
07 Jan 2012 06:59 PM
Could you please tell us the output?
-_-
you're making it too hard to work with.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jan 2012 07:01 PM
stack overflow.


Cheers,
-- AFF

~ 121/97/103 109/97 105
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 07:04 PM
@ro, It freezes when I test in edit mode, and It wont respond when I try testing play solo, so I haven't been able to get the output ): sorry.
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
07 Jan 2012 07:05 PM
I don't get how it would 'freeze.'
It's probably some other scripts in your game.
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
07 Jan 2012 07:05 PM
@Agent, the wait worked! Thanks so much!!
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jan 2012 07:06 PM
add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script. add a wait() right after 'while true do' in your script.


Cheers,
-- AFF

~ 121/97/103 109/97 105
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jan 2012 07:06 PM
Late spam post is late.
Glad I could help. :)


Cheers,
-- AFF

~ 121/97/103 109/97 105
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
07 Jan 2012 07:10 PM
I don't understand.
Isn't wait() just nothing?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jan 2012 08:31 PM
The smallest delay possible using wait is one frame, or 0.03 seconds in Roblox.
The delay is required for a while loop in most cases.


Cheers,
-- AFF

~ 121/97/103 109/97 105
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