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: Error -- No Output

Previous Thread :: Next Thread 
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 03:32 PM
This script was working completely...Than I added in the mapNum and the rest of the map stuff in the 'while true do' part. I guarantee the issue is there. However, there may be new difficulties in the function, as I also edited to that. Please read through the script and tell me the issue.

--This script was 100% written by bballer13sn.

print("Bballer's Minigame Script Loaded")

local Msg = game.Workspace.Message
local h = game.Workspace.Hint

while true do
wait(30)
local plyrs = game.Players:GetChildren()
if #plyrs >= 2 then
local num = 1
local mapNum = 1
Msg.Text = "Choosing Map..."
wait(3)
if mapNum == 1 then
Msg.Text = "Grassy Knoll Map Chosen!"
local GKM = game.Lighting.GrassyKnollMap:clone()
GKM.Parent = game.Workspace
GKM.Name = "Map"
end
wait(3)
Msg.Text = "Choosing Minigame..."
if num == 1 then
Msg.Text = "All on One Sword Fight Chosen!"
wait(3)
Msg.Text = "And the Unlucky Target Is..."
wait(5)
Msg.Text = ""
Minigame1()
end
game.Workspace.Map:remove()
end
end


function Minigame1()
local plrs = game.Players:GetChildren()
local TargetMG1 = plrs[math.random(1, #plrs)]
local RegPlayers = game.Workspace.Map.Tele1
local TarPlayers = game.Workspace.Map.Tele4
Msg.Text = TargetMG1.Name
wait(3)
Msg.Text = ""
h.Text = "Starting Mini-Game."
wait(.5)
h.Text = "Starting Mini-Game.."
wait(.5)
h.Text = "Starting Mini-Game..."
wait(.5)
h.Text = "Starting Mini-Game.."
wait(.5)
h.Text = "Starting Mini-Game."
wait(.5)
h.Text = ""
for i = 1, #plrs do
if (plrs[i].Name ~= TargetMG1.Name) then
local Still_InMG1 = Instance.new("IntValue")
Still_InMG1.Name = "StillInMG1"
Still_InMG1.Parent = plrs[i].Character
local MainWepMG1 = game.Lighting:findFirstChild("TargetLinkedSword"):clone()
MainWepMG1.Kill.Value = TargetMG1.Name
MainWepMG1.Parent = plrs[i].Backpack
plrs[i].Character.Torso.CFrame = RegPlayers.Position
else
local Tar_InMG1 = Instance.new("IntValue")
Tar_InMG1.Name = "TarInMG1"
Tar_InMG1.Parent = game.Players:findFirstChild(TargetMG1.Name).Character
local TarWepMG1 = game.Lighting:findFirstChild("GoldenKatana"):clone()
TarWepMG1.Parent = plrs[i].Backpack
plrs[i].Character.Torso.CFrame = TarPlayers.Position
end
end
h.Text = "Kill the Target before he/she kills you!"
while true do
wait(1)
for i = 1,#plrs do
local MG1PlrCount = game.Players.NumPlayers
if (plrs:findFirstChild(TargetMG1.Name).Character.TarInMG1 == nil) then
h:remove()
Msg.Text = "The Target died! All survivors will be awarded 25 Points."
wait(5)
Msg:remove()
if (plrs[i].Character.StillInMG1 ~= nil) then
plrs[i].leaderstats["Points"].Value = plrs[i].leaderstats["Points"].Value + 25
plrs[i].Character.Humanoid.Health = 0
end
else
if (plrs[i].Character.StillInMG1 == nil) then
MG1PlrCount = MG1PlrCount - 1
if MG1PlrCount == 0 then
h:remove()
Msg.Text = "The Target won! The Target will be awarded 50 Points."
wait(5)
Msg:remove()
plrs:findFirstChild(TargetMG1.Name).leaderstats["Points"].Value = plrs[i].leaderstats["Points"].Value + 50
game.Workspace:findFirstChild(TargetMG1.Name).Humanoid.Health = 0
end
end
end
end
end
end
Report Abuse
CardCaddy is not online. CardCaddy
Joined: 02 Jan 2010
Total Posts: 1025
05 Aug 2011 03:40 PM
This is the kind of thing that you have to debug yourself, checking each part using 'print()' and such.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 03:42 PM
...Did that...Still no output. It's obviously an invisible error to Output.
Report Abuse
CardCaddy is not online. CardCaddy
Joined: 02 Jan 2010
Total Posts: 1025
05 Aug 2011 03:44 PM
Make sure your output isn't breaking. Is the first line at least printing?
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 03:46 PM
All lines were printing. Yes. No offense to you, Card, as I know you're a respectable scripter, but...Output is of no use right now. I know that it isn't a parenting issue, but something else. Please help.
Report Abuse
CardCaddy is not online. CardCaddy
Joined: 02 Jan 2010
Total Posts: 1025
05 Aug 2011 03:51 PM
Well considering the whole script relies on the loop 'while true do', you were right in that it has to be in there. The only things I can say are that you either didn't actually wait for 30 seconds, or there weren't 2 or more players. Other than that, I don't see any problems.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 03:52 PM
Well, I had a server of five, and waited five minutes. Thank you for reading it, but it still didn't work. I've read through it several times and have found no error.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 03:59 PM
I do thank you for your help, however.
Report Abuse
CardCaddy is not online. CardCaddy
Joined: 02 Jan 2010
Total Posts: 1025
05 Aug 2011 04:04 PM
Just ran this EXACT code. Worked for me.


message = workspace.Message

while true do
wait(30)

if #game.Players:GetChildren() >= 2 then
number = 1
map_number = 1

message.Text = "Choosing map..."
wait(3)

if map_number == 1 then
message.Text = "Grassy Knoll Map chosen!"
map = game.Lighting.GrassyKnollMap:Clone()
map.Parent = workspace
map.Name = "Map"
end

wait(3)
message.Text = "Choosing minigame..."

if number == 1 then

wait(3)
message.Text = "All On One Sword Fight chosen!"
wait(3)
message.Text = "And the unlucky target is..."
wait(5)

random_number = math.random(1, #game.Players:GetChildren())

for a, b in pairs(game.Players:GetChildren()) do
if a == random_number then
message.Text = b.Name
end
end

wait(5)
message.Text = ""
end

workspace.Map:remove()
end
end
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:07 PM
That looks perfect, but not for me. I need the random player to be chosen in Minigame1() so that I can finish up the game.
Report Abuse
CardCaddy is not online. CardCaddy
Joined: 02 Jan 2010
Total Posts: 1025
05 Aug 2011 04:10 PM
Oh ok, just edit my script. I just wanted to make sure that the basic thing was running.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
05 Aug 2011 04:11 PM
It's odd how you call CardCaddy a respectable scripter, yet he doesn't realize that the while loop completely pauses the thread, causing the function Minigame1 to never be created.

I find it sad how much this forum has declined. Or is it just an off day for this forum, or perhaps just for CardCaddy? I hope so.

As for the problem, put everything above the "while true do" loop, otherwise it will never run. That should fix at least one problem. Don't see any others.

-Like a boss.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:11 PM
Okay, thank you. However...I still would like to know what I did wrong.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:12 PM
Crazy...RBX.Lua's decompiler reads the entire script as a whole, then executes it. The placement of functions is 100% Unrelated. I know you, too, are a respected scripter, more so than many others.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
05 Aug 2011 04:15 PM
Yes, it _reads_ the entire script, but it executes it from top to bottom. It never defines the function.


Script:

while true do
wait(1)
print(var)
end

var = 5

Output:

Fri Aug 05 17:14:36 2011 - Running Script "Workspace.Script"
nil
nil
nil
nil
nil

-Like a boss.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:16 PM
...So, I have to put my functions prior to the while true do? I'll try it.
Report Abuse
CardCaddy is not online. CardCaddy
Joined: 02 Jan 2010
Total Posts: 1025
05 Aug 2011 04:20 PM
@crazy, that really isn't high on my priority list when trying to fix this. He said nothing was happening, and there was no output. I tried to figure out why that was. Not having defined the function wouldn't have caused that problem. If the function would have been the problem, it would have errored.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:21 PM
True...Do keep in mind this script worked perfectly prior to me adding into the While True Do the map part.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:39 PM
Still not working...
Report Abuse
myrco1001 is not online. myrco1001
Joined: 17 Sep 2010
Total Posts: 2574
05 Aug 2011 04:44 PM
Sorry, but currently I'm quite lazy - perhaps you can put print(«lineNumber») on the Scripting lines to see what it does print and what doesn't.
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:44 PM
I already did that...And it printed EVERYTHING...
Report Abuse
myrco1001 is not online. myrco1001
Joined: 17 Sep 2010
Total Posts: 2574
05 Aug 2011 04:47 PM
Q_Q, so what's the current problem?
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:48 PM
It won't start...At all.
Report Abuse
myrco1001 is not online. myrco1001
Joined: 17 Sep 2010
Total Posts: 2574
05 Aug 2011 04:49 PM
*Sigh*«BrainDeadImput»*Sigh*
Report Abuse
bballer13sn is not online. bballer13sn
Joined: 03 Jun 2009
Total Posts: 2490
05 Aug 2011 04:49 PM
Lol
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