Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Random name chooser doesn't work as I expected?

What it's supposed to do is select a random name then when the numbervalue in workspace is >= 74 it now changes to hurricane.

tldr/example

Tropical Storm Harvey <= 73. Passes >= 74. Now Hurricane Harvey

The opposite is supposed to occur to

Hurricane Harvey <= 74. Goes below <= 73. Now Tropical Storm Harvey

local name = math.random(18)

nameselected = ""

if name == 1 then
	script.Parent.Value = "Tropical Storm Arlene"
	nameselected = "Arlene"
end
if name == 2 then
	script.Parent.Value = "Tropical Storm Bret"
	nameselected = "Bret"
end
if name == 3 then
	script.Parent.Value = "Tropical Storm Cindy"
	nameselected = "Cindy"
end
if name == 4 then
	script.Parent.Value = "Tropical Storm Don"
	nameselected = "Don"
end
if name == 5 then
	script.Parent.Value = "Tropical Storm Emily"
	nameselected = "Emily"
end
if name == 6 then
	script.Parent.Value = "Tropical Storm Franklin"
	nameselected = "Franklin"
end
if name == 7 then
	script.Parent.Value = "Tropical Storm Gert"
	nameselected = "Gert"
end
if name == 8 then
	script.Parent.Value = "Tropical Storm Harvey"
	nameselected = "Harvey"
end
if name == 9 then
	script.Parent.Value = "Tropical Storm Irma"
	nameselected = "Irma"
end
if name == 10 then
	script.Parent.Value = "Tropical Storm Jose"
	nameselected = "Jose"
end
if name == 11 then
	script.Parent.Value = "Tropical Storm Katia"
	nameselected = "Katia"
end
if name == 12 then
	script.Parent.Value = "Tropical Storm Lee"
	nameselected = "Lee"
end
if name == 13 then
	script.Parent.Value = "Tropical Storm Maria"
	nameselected = "Maria"
end
if name == 14 then
	script.Parent.Value = "Tropical Storm Nate"
	nameselected = "Nate"
end
if name == 15 then
	script.Parent.Value = "Tropical Storm Ophelia"
	nameselected = "Ophelia"
end
if name == 16 then
	script.Parent.Value = "Tropical Storm Philippe"
	nameselected = "Philippe"
end
if name == 17 then
	script.Parent.Value = "Tropical Storm Rina"
	nameselected = "Rina"
end
if name == 18 then
	script.Parent.Value = "Tropical Storm Katrina"
	nameselected = "Katrina"
end

if script.Parent.Parent.Winds.Value >= 74 then
	script.Parent.Value = "Hurricane " ..nameselected
end

2 comments

0

hmmm ok

0

This looks like this entire script runs once. I would put the part in which you check for the wind's speed in a loop, so it is constantly checking for the speed.

2 answers

✓ Accepted answer

Hey Logan, here is simplified method. This is example and you need to edit it. Let's see:

local NamesTable= {"Name1", "Name2", "Name3"} -- this is names table. Put here all of your names
local NameCounts = 3 --change here how much names do you put into names table(very important)


while wait(3) do --this cycle retrying every 3 secs 
	local Number = math.random(1,NameCounts) -- generates random number
	for i = 1, #Table do -- searching that name(string) example 1 is Name1. 2 is Name2
		if Number == i then
			print(Table[i]) -- printing that name
			-- other stuff here
		end
	end
end

P.S sorry for my bad english again :d

2 comments

0

It doesn't work sadly though. Also the naming system works by calling it a "tropical storm" if its winds are 73 or below mph and a "hurricane" if its winds are 74 or more mph. The opposite should happen to when it goes below 74 mph called a tropical storm again.

0

can't NameCounts be #NamesTable?

Maybe this?

if script.Parent.Parent.Winds.Changed:Connect()
	if script.Parent.Parent.Winds.Value >= 74 then
   		script.Parent.Value = "Hurricane " ..nameselected
	else
		script.Parent.Value = "Tropical Storm " ..nameselected
	end
end)

4 comments

0

Doesn't work either :/

0

Whats it do?

0

Oh ok so question, how were these values created, what kind of script, and what kind of script are we using to change them? Local or server

0

Server.

This discussion is preserved as it was. New answers, comments, and votes are closed.