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

Player pad map chooser?

Asked by 10 years ago

How could i get it so a play can select a map with pads for example: Murder Mystery. I made one with a mouse hover function but... the second round its not stable.

Here is the function i am using to give the pads a task. It works for like one round but then the second loop it does not fire right, no map titles. This all works fine until the map titles don't show the next round or game.

List1 = Game.Lighting.List1:GetChildren()
List2 = Game.Lighting.List2:GetChildren()
List3 = Game.Lighting.List3:GetChildren()
Randomize1 = List1[math.random(1,#List1)]
Randomize2 = List2[math.random(1,#List2)]
Randomize3 = List3[math.random(1,#List3)]
script.Map1.Value = Randomize1.Name
script.Map2.Value = Randomize2.Name
script.Map3.Value = Randomize3.Name

1 answer

Log in to vote
0
Answered by 10 years ago

Well, it appears you'd need this to be called every time it starts the new game? So there are two ways to do that. 1) Disable the script and then re-enable it when the map needs to be picked 2) Call it as a function

function random_map()
    List1 = Game.Lighting.List1:GetChildren()
    List2 = Game.Lighting.List2:GetChildren()
    List3 = Game.Lighting.List3:GetChildren()
    Randomize1 = List1[math.random(1,#List1)]
    Randomize2 = List2[math.random(1,#List2)]
    Randomize3 = List3[math.random(1,#List3)]
    script.Map1.Value = Randomize1.Name
    script.Map2.Value = Randomize2.Name
    script.Map3.Value = Randomize3.Name
end

start.MouseButton1Click:connect(random_map) --Just an example, you'd want to connect a different event so that it randomizes a map after each game
0
Oh, here is. Li Aaronoles 55 — 10y
Ad

Answer this question