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

help me with this math.Random script?

Asked by 10 years ago

Hey, so I'm making a game that requires math.Random for a map to appear. I don't completely understand how to use it, so here it is

math.Random#(Maps 1,3)
If math.Random = 1 then
game.ServerStorage.1.Parent = "WorkSpace"

I'm stuck after that. I guessed how to do the whole thing. Help me please?

1 answer

Log in to vote
3
Answered by 10 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

If what you're trying to do is make a map appear based on a random number then try this-

Maps = {"Map1", "Map2", "Map3"} --Change these to the names of your maps
n = math.random(1, 3) --Finds a random number between 1, and the number of maps you have
Map = game.ServerStorage:FindFirstChild(Maps[n]) --Go into ServerStorage and find the names of the maps listed in the table, and the corresponding random number.
Map.Parent = game.Workspace --Take the map out of ServerStorage and place it into the Workspace
0
I'll let you now how it goes, GreekGodOfMLG 244 — 10y
0
worked! GreekGodOfMLG 244 — 10y
Ad

Answer this question