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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: math.random error

Previous Thread :: Next Thread 
blackhalodude is not online. blackhalodude
Joined: 16 Jun 2010
Total Posts: 412
05 Apr 2012 07:33 AM
Output: Players.Player.PlayerGui.FactGUI.Script:3: function arguments expected near 'pick'

local frame = script.Parent.frame
local facts = script.Parent.Facts:GetChildren
pick = (math.random(1, #facts))

while true do
wait(math.random(1, 5))
frame.Fact.Text = pick.Value
print "Picked a fact."
frame:TweenPosition(UDim2.new(0, 50, 0, 450) "Out", "Bounce", 2)
print "Tweened in the frame."
wait(17)
frame:TweenPosition(UDim2.new(-1, 0, 0, 450) "Out", Linear", 2)
print "Tweened out the frame."
wait(2.1)
frame.Fact.Text = ""
print "Script sucsess!"
end
Report Abuse
radiogamer is not online. radiogamer
Joined: 06 Oct 2008
Total Posts: 1975
05 Apr 2012 07:35 AM
line 2, misses () after getChildren
Report Abuse
Fredfishy is not online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
05 Apr 2012 07:36 AM
"local frame = script.Parent.frame
local facts = script.Parent.Facts:GetChildren
pick = (math.random(1, #facts))"

Should be

"local frame = script.Parent.frame
local facts = script.Parent.Facts:GetChildren()
pick = (math.random(1, #facts))"

Any method (eg, :Remove(), :FindFirstChild("")) ALWAYS needs to have arguments specified after it. If there aren't any, you just put two brackets.
e.g

FindFirstChild("humanoid") -- The argument here is "humanoid"
Remove() -- There are no arguments here, but we must still put the brackets.
Report Abuse
blackhalodude is not online. blackhalodude
Joined: 16 Jun 2010
Total Posts: 412
05 Apr 2012 07:41 AM
Their is another error now :(


Players.Player.PlayerGui.FactGUI.Script:7: attempt to index global 'pick' (a number value)
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
05 Apr 2012 07:49 AM
[ Content Deleted ]
Report Abuse
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
05 Apr 2012 08:25 AM
local frame = script.Parent.frame
local facts = script.Parent.Facts:GetChildren()
pick = (math.random(1, #facts))

while true do
wait(math.random(1, 5))
frame.Fact.Text = pick ------------------- pick is a number.
print "Picked a fact."
frame:TweenPosition(UDim2.new(0, 50, 0, 450) "Out", "Bounce", 2)
print "Tweened in the frame."
wait(17)
frame:TweenPosition(UDim2.new(-1, 0, 0, 450) "Out", Linear", 2)
print "Tweened out the frame."
wait(2.1)
frame.Fact.Text = ""
print "Script sucsess!"
end
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
05 Apr 2012 10:46 AM
frame.Fact.Text = ""..pick..""
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
05 Apr 2012 10:54 AM
local frame = script.Parent.frame
local facts = script.Parent.Facts:GetChildren()
pick = facts[(math.random(1, #facts))]

while true do
wait(math.random(1, 5))
frame.Fact.Text = pick.Value
print "Picked a fact."
frame:TweenPosition(UDim2.new(0, 50, 0, 450) "Out", "Bounce", 2)
print "Tweened in the frame."
wait(17)
frame:TweenPosition(UDim2.new(-1, 0, 0, 450) "Out", Linear", 2)
print "Tweened out the frame."
wait(2.1)
frame.Fact.Text = ""
print "Script sucsess!"
end
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
05 Apr 2012 11:09 AM
local frame = script.Parent.frame
local facts = script.Parent.Facts:GetChildren()
local pick = (math.random(1, #facts))

while true do
wait(math.random(1, 5))
frame.Fact.Text = pick.Value
print "Picked a fact."
frame:TweenPosition(UDim2.new(0, 50, 0, 450) "Out", "Bounce", 2)
print "Tweened in the frame."
wait(17)
frame:TweenPosition(UDim2.new(-1, 0, 0, 450) "Out", Linear", 2)
print "Tweened out the frame."
wait(2.1)
frame.Fact.Text = ""
print "Script sucsess!"
end
Report Abuse
blackhalodude is not online. blackhalodude
Joined: 16 Jun 2010
Total Posts: 412
05 Apr 2012 04:32 PM
Well, I want the script so that it randomly picks a child from something and it gets the string value and put the string value in a gui. Can someone modify the script so it does that please.
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
06 Apr 2012 09:36 AM
Mine does that... >_>
Report Abuse
bagwan12345 is not online. bagwan12345
Joined: 17 Dec 2009
Total Posts: 1498
06 Apr 2012 09:50 AM
Try the tostring() function (And yes, that too needs brackets 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