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 » Scripters
Home Search
 

Re: Why can't I print this?

Previous Thread :: Next Thread 
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
03 Jul 2015 09:48 PM
function ChildNormal()
local Normi = game.Lighting.Baby:GetChildren()[Normal()]
return Normi
end

print(ChildNormal().Monster.Name.Value)

I'm sure I made a huge error, what did I do wrong?
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
03 Jul 2015 09:49 PM
well wtf is

[Normal()]
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
03 Jul 2015 09:52 PM
Oh, from another function:

function Normal()
local r = math.random(1, NormalMonsters)
return r
end
print(Normal())
end
wait(5)
end
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
03 Jul 2015 09:53 PM
It didn't come back as Nil or anything either- so I'm thinking it just didn't run right.
Report Abuse
Bglob is not online. Bglob
Joined: 22 Dec 2009
Total Posts: 66
03 Jul 2015 09:59 PM
Whats Normi
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
03 Jul 2015 10:04 PM
local Normi = game.Lighting.Baby:GetChildren()
return Normi


print(Stuff.Monster.Name.Value)--Functions don't have children.

u sicko!
Report Abuse
BowtieMod is not online. BowtieMod
Joined: 01 Apr 2013
Total Posts: 804
03 Jul 2015 10:12 PM
You're right

Function don't have children

They weren't getting the children of function

They were using the function to get children :uuu
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
03 Jul 2015 10:43 PM
Well it's not printing...
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
04 Jul 2015 07:26 AM
So with what Botie just said, "using the function to get children"
'And the fact that I'm finding the exact child I want with math.random-
Who can provide me with accurate script help to fix my issue?


BTW, Happy 4th of July if you're American! 'And have a nice day anyways if you're not!!!
Report Abuse
Harple is not online. Harple
Joined: 08 Oct 2012
Total Posts: 2006
04 Jul 2015 07:46 AM
what?! idk how you people script so majestic things. :3
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
04 Jul 2015 07:49 AM
Not sure if sarcasm, or doesn't understand how simple this is...

I just can't get it because I'm not sure how to call the child correctly in this instance.
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
04 Jul 2015 08:15 AM
Hmmm...


Okay, lets see if I can explain what I'm trying to do better so someone can actually help:


I'm trying to make it so that for example, if the name of one of the children of "Baby" is named 1, and math.random returns a 1, then this script will print 1's stored name that is hidden in it's humanoid named Monster and get the Monster.Name.Value (It's a string value)...

I'm using print as a test so that I can get info from the model to display onto a GUI.

Am I making it easier or harder to understand?

Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
04 Jul 2015 10:29 AM
Sorry, but "Bump".
Report Abuse
Harple is not online. Harple
Joined: 08 Oct 2012
Total Posts: 2006
04 Jul 2015 12:13 PM
I would help you if my scripting abilities were intermediate - advanced

But sadly, I am a trash scripter
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
04 Jul 2015 12:25 PM
Me too. : )
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
04 Jul 2015 03:41 PM
You guys would give me fireworks in my trousers if you helped out. ; )
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
04 Jul 2015 09:20 PM
This is bothering me so much..... I feel like I made the simplest of errors..........
Report Abuse
Veltamax is not online. Veltamax
Joined: 06 May 2012
Total Posts: 368
04 Jul 2015 09:24 PM
Try this

local normaltable = game.Lighting.Baby:GetChildren()
local normi = normaltable[math.random(1,#normaltable)]

print(normi.Monster.Name.Value)
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
05 Jul 2015 07:59 AM
That doesn't work... Here, I'll post the entire script.....
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
05 Jul 2015 08:00 AM
while true do


NonRare = game.Lighting.Baby
Rare = game.Lighting.RareBaby

NormalMonsters = 1 --How many baby monsters are in the game.
RareMonsters = 10 --Obv not how many RARE pepe monsters r in game m8



function RareOrNot()
local r = math.random(1, 12)
return r
end

print(RareOrNot())
-------------------------------------------------------
if (RareOrNot()) == 7 then --(TEZT) or 8 or 9 or 10 or 11 or 12 then
Monster = Rare
else
Monster = NonRare
end
-------------------------------------------------------
if Monster == Rare then
function Rare()
local r = math.random(6, RareMonsters)
return r
end
print(Rare())
end
-------------------------------------------------------
if Monster == NonRare then
function Normal()
local r = math.random(1, NormalMonsters)
return r
end
print(Normal())
end
wait(5)
end



if Monster == NonRare then
function ChildNormal()
local Normi = game.Lighting.Baby:GetChildren()[Normal()]
return Normi
end

print(ChildNormal().Monster.Name.Value)
Report Abuse
axelvts is not online. axelvts
Joined: 27 Apr 2008
Total Posts: 3029
05 Jul 2015 08:01 AM
I meant to move the wait 5 back to the end. : /
Oh well.
Report Abuse
Harple is not online. Harple
Joined: 08 Oct 2012
Total Posts: 2006
05 Jul 2015 11:03 AM
Well, something is wrong with line 45, no idea what, but this is what I get;

http://gyazo[DOT]com/606d5b97c9f53775830b493b053ffec1
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
05 Jul 2015 11:28 AM
First lets format your code so its easier to read. I have to tell you, none of what you are doing makes any sense. I think there is an easier way to detect which monster is normal or rare.

local nonRare = game.ServerStorage.Baby
local rare = game.ServerStorage.RareBaby

local normMonsters = 1
local rareMonsters = 10

function rareOrNot()
local r = math.random(1, 12)
return r
end

if rareOrNot() == 7 then
monster = rare
else
monster = nonRare
end

if monster == rare then
function Rare()
local r = math.random(6, rareMonsters)
return r
end
end

if monster == nonRare then
function normal()
local r = math.random(1, normMonsters)
return r
end
end

if monster == nonRare then
function ChildNormal()
local norm = game.ServerStorage.Baby:GetChildren()
return norm
end
end


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
05 Jul 2015 12:14 PM
Aight. I think I got it. I was bored so I was trying to figure this out haha. I hope this helps.

local rare = game.ServerStorage.RareBaby
local nonRare = game.ServerStorage.Baby

rareMonsters = 7
normMonsters = 1

function rareMon()
local r = math.random(6, rareMonsters)
return r
end

function normMon()
local r = math.random(1, normMonsters)
return r
end

function rareOrNot()
local r = math.random(1, 12)
return r
end

function childRare()
rareMon()
for i,v in next, rare:GetChildren() do
if i == rareMon() then
print(v.StringValue.Value)
end
end
end

function childNorm()
normMon()
for i,v in next, nonRare:GetChildren() do
if i == normMon() then
print(v.StringValue.Value)
end
end
end

local monster
if rareOrNot() > 7 then
monster = rare
else
monster = nonRare
end

if monster == rare then
childRare()
elseif monster == nonRare then
childNorm()
end


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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