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

How to display all of the Billboard Gui's and not just one?

Asked by 2 years ago
local display = dice.RI.numdisplay and dice.RII.numdisplay and dice.WI.numdisplay and dice.WII.numdisplay and dice.WIII.numdisplay and dice.WIV.numdisplay and dice.WV.numdisplay and dice.WVI.numdisplay

Whenever I roll my dice, only dice WVI displays its billboard gui, how do I make them all show their billboard gui?

full script if you want to know:

local ts = game:GetService("TweenService")
local p1 = script.Parent.Parent.rollmove.RI
local p2 = script.Parent.Parent.rollmove.RII
local box = script.Parent.Parent.rollmove.Box
local click = script.Parent.ClickDetector
local dicee = script.Parent.Parent.rollmove.dice:GetChildren()
local dice = script.Parent.Parent.rollmove.dice
local dicenum = #dicee
local display = dice.RI.numdisplay and dice.RII.numdisplay and dice.WI.numdisplay and dice.WII.numdisplay and dice.WIII.numdisplay and dice.WIV.numdisplay and dice.WV.numdisplay and dice.WVI.numdisplay

for i = 1,dicenum do
    local diceget = dicee[i]
    diceget.Anchored = true
end
local default_dist = script.Parent.ClickDetector.MaxActivationDistance
script.Parent.ClickDetector.MouseClick:Connect(function(player)
    game.ReplicatedStorage.Roll:FireAllClients()
    script.Parent.ClickDetector.MaxActivationDistance = 0
    script.Parent.SurfaceGui.Rolling.Visible = true
    script.Parent.SurfaceGui.Roll.Visible = false

    wait()
    local function moveItem(item, wp)
        local ti = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
        local tween = ts:Create(item, ti, { Position = wp.Position})
        tween:Play()
        wait(2)
    end
    local function moveItems(item, wp)
        local ti = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
        local tween = ts:Create(item, ti, { Position = wp.Position})
        tween:Play()
        wait(0.1)
    end
    for i = 1,dicenum do
        local diceget = dicee[i]
        moveItems(diceget, p1)
    end
    moveItem(box, p1)
    for i = 1,dicenum do
        local diceget = dicee[i]
        diceget.Transparency = 1
        moveItems(diceget, p2)
    end
    moveItem(box, p2)
    box.Orientation = Vector3.new(0,180,180)
    for i = 1,dicenum do
        local diceget = dicee[i]
        diceget.Transparency = 0
        diceget.Anchored = false
    end
    display.Enabled = true
    wait(6)
    for i = 1,dicenum do
        local diceget = dicee[i]
        diceget.Anchored = true
        diceget.Transparency = 1
        moveItems(diceget, p1)
        display.Enabled = false
    end
    moveItem(box,p1)
    box.Orientation = Vector3.new(0,0,0)
    script.Parent.SurfaceGui.Rolling.Visible = false
    script.Parent.SurfaceGui.Roll.Visible = true
    script.Parent.ClickDetector.MaxActivationDistance = default_dist    
end)

1 answer

Log in to vote
1
Answered by 2 years ago
Edited 2 years ago

Well hello again! You could use a for loop to go though each of the guis one by one.

Heres a code you could use!

for i,dicenum do 
  local diceget = dicee[i]
  local display = diceget.numdisplay
  -- do whatever you need to get display on to the billboardgui.
  wait(3)
end

you see you assigned multiple values to just 1 variable so it will randomly pick 1 value and just display it!

Hope this helped!

Any questions? Just ask!

0
Very helpful! Jakob_Cashy 79 — 2y
0
Thanks! sne_123456 439 — 2y
0
Just to add more info: When assigning more values into one variable, this will get the last value of the variable and it won't actually get the rest.  I don't know for certain why it does that i'd assume, it get's the last value of x because of the logical operators, since it checks to see if the previous values were true which gets the bool values, then it gets the last value JesseSong 3916 — 2y
0
It wouldn't randomly choose 1 variable, it would get the last value. It would only pick a random variable if all of the objects were named the exact same thing, cause the script wouldn't know which one to choose. JesseSong 3916 — 2y
View all comments (2 more)
1
oh ok thanks for the info sne_123456 439 — 2y
Ad

Answer this question