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: No errors but it won't work... help?

Previous Thread :: Next Thread 
NuclearBombx is not online. NuclearBombx
Joined: 15 Nov 2013
Total Posts: 847
29 Nov 2013 04:49 PM
function text(m, p, ti, ty)
coroutine.wrap(function()
local te = Instance.new(ty, p)
te.Text = m
wait(ti)
te:Destroy()
end)()
end


while wait(15) do
if (game.Players.NumPlayers < 2) then
repeat
text('Not enough players: at least two needed (' .. game.Players.NumPlayers .. ').', game.Workspace, 3, 'Message')
wait(3)
until game.Players.NumPlayers >= 2
end

local maps = game.Lighting.Maps:GetChildren()
local map = maps[math.random(1, #maps)]:clone()
map.Parent = game.Workspace
map:MakeJoints()

text('Chosen map: ' .. map.Name, game.Workspace, 3, 'Message')

local players = game.Players:GetPlayers()
_G['it'] = players[math.random(1, game.Players.NumPlayers)].Character

text('The Golden One is ' .. _G.it.Name .. '!', game.Workspace, 3, 'Hint')
_G.it.Humanoid.WalkSpeed = 25
_G.it.Humanoid.MaxHealth = 500
_G.it.Humanoid.Health = 500
local time = 120

repeat
time = time - 1
wait(1)
until time == 0 or _G.it.Humanoid.Health == 0

if (_G.it.Humanoid.Health == 0) then
text('The Golden One has been slain!', game.Workspace, 3, 'Message')
else
text('The Golden One has survived for two minutes!', game.Workspace, 3, 'Message')
end

wait(3)
map:Destroy()
text('Intermission', game.Workspace, 15, 'Hint')
end

It won't run after the choosing part, not sure why as it doesn't come up with errors. Help?
Report Abuse
NuclearBombx is not online. NuclearBombx
Joined: 15 Nov 2013
Total Posts: 847
29 Nov 2013 05:58 PM
Anyone? Please?
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
29 Nov 2013 06:00 PM
Coroutine is a natural pcall, try commenting that out and see if you get an error.
Report Abuse
NuclearBombx is not online. NuclearBombx
Joined: 15 Nov 2013
Total Posts: 847
29 Nov 2013 06:00 PM
Well, there is an error or it wouldn't work but the output doesn't show anything.
Report Abuse
NuclearBombx is not online. NuclearBombx
Joined: 15 Nov 2013
Total Posts: 847
29 Nov 2013 06:01 PM
Still no errors :l
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
29 Nov 2013 06:02 PM
Like I said, if there's a problem and your coroutine is letting it through, it won't print to output. Comment it out to see if there's a problem that your coroutine is preventing you from seeing.
Report Abuse
NuclearBombx is not online. NuclearBombx
Joined: 15 Nov 2013
Total Posts: 847
29 Nov 2013 06:03 PM
Just testing it... kid of lagging. Thanks for the help.
Report Abuse
NuclearBombx is not online. NuclearBombx
Joined: 15 Nov 2013
Total Posts: 847
29 Nov 2013 06:06 PM
Workspace.Main:7: unexpected symbol near ')'
Eh...
Report Abuse
NuclearBombx is not online. NuclearBombx
Joined: 15 Nov 2013
Total Posts: 847
29 Nov 2013 06:09 PM
Hah, finally showing up.
Workspace.Main:29: attempt to index field 'it' (a nil value)
Not sure why...
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
29 Nov 2013 06:12 PM
_G.it.Name --Isn't there, figure out why. I'd give more help, but I can't set up a test environment for this.
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