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: math random i need help

Previous Thread :: Next Thread 
pay2winmaster is not online. pay2winmaster
Joined: 05 Sep 2017
Total Posts: 36
27 Sep 2017 02:51 PM
im just testing some math random stuff what did i did wrong if the scripts is wrong wrong dont laugh im just doing experiments
script -
script.Parent.Touched:connect(function()
while true do
printtochoosefrom = math random(1.3)
if printtochoosefrom == 1 then
print("what")
end
if printtochoosefrom == 2 then
print("who")
end
if printtochoosefrom == 3 then
print("when")
end
end)
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
27 Sep 2017 02:53 PM
a lot is wrong
script.Parent.Touched:Connect(function()
while true do
local printtochoosefrom = math random(1, 3)
if printtochoosefrom == 1 then
print("what")
elseif printtochoosefrom == 2 then
print("who")
elseif printtochoosefrom == 3 then
print("when")
end
end)
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
27 Sep 2017 02:55 PM
script.Parent.Touched:Connect(function()
local printtochoosefrom = math random(1, 3)
if printtochoosefrom == 1 then
print("what")
elseif printtochoosefrom == 2 then
print("who")
elseif printtochoosefrom == 3 then
print("when")
end
end)

You also made absolutely 0 sense.
Report Abuse
pay2winmaster is not online. pay2winmaster
Joined: 05 Sep 2017
Total Posts: 36
27 Sep 2017 02:55 PM
ow thank you so much for your help sir
Report Abuse
pay2winmaster is not online. pay2winmaster
Joined: 05 Sep 2017
Total Posts: 36
27 Sep 2017 02:57 PM
dint work script.Parent.Touched:Connect(function()
while true do
local printtochoosefrom = math random(1, 3)
if printtochoosefrom == 1 then
print("what")
elseif printtochoosefrom == 2 then
print("who")
elseif printtochoosefrom == 3 then
print("when")
end
end)

it said unexpectted sysmbol at ) what is this problem
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
27 Sep 2017 02:58 PM
use the second one I posted..
Report Abuse
pay2winmaster is not online. pay2winmaster
Joined: 05 Sep 2017
Total Posts: 36
27 Sep 2017 02:58 PM
now it says Workspace.Part.Script:2: attempt to call global 'random' (a nil value)
Report Abuse
gohan31865 is not online. gohan31865
Joined: 30 Jan 2011
Total Posts: 895
27 Sep 2017 03:46 PM
local content = {
[1] = "what";
[2] = "who"; --this is a table; it stores strings, numbers, and bools, and in some cases
other stuff like instances
[3] = "when";
};

script.Parent.Touched:Connect(function() --anonymous function
local printtochoosefrom = math.random(1,3)
print(content[printtochoosefrom]) --since 'printtochoosefrom' is a number, we can apply it
in the array of stuff inside the table
end)


#code error("you're*")
Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
27 Sep 2017 03:59 PM
The reason why you received that error is because you both forgot to use math.random


Report Abuse
pay2winmaster is not online. pay2winmaster
Joined: 05 Sep 2017
Total Posts: 36
28 Sep 2017 12:34 AM
lol
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