Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Random name chooser doesn't work as I expected?

Asked by 5 years ago
Edited 5 years ago

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
0
hmmm ok Tizzel40 243 — 5y
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. Xylophyll 0 — 5y

2 answers

Log in to vote
1
Answered by
HaveASip 494 Moderation Voter
5 years ago
Edited 5 years ago

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

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. LoganboyInCO 150 — 5y
0
can't NameCounts be #NamesTable? the8bitdude11 358 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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)
0
Doesn't work either :/ LoganboyInCO 150 — 5y
0
Whats it do? DinozCreates 1070 — 5y
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 DinozCreates 1070 — 5y
0
Server. LoganboyInCO 150 — 5y

Answer this question