I'm trying to make it so it will return a random number with in a 0 to a (-800) range, How would I do this? This is what I have so far:
while true do
NUM1:TweenSize(UDim2.new(0, 100,0,math.random()),"Out","Linear",0.05,false)
wait(0.2)
end
I'm trying to make it so it will return a random number with in a 0 to a (-800) range, How would I do this? This is what I have so far:
while true do
NUM1:TweenSize(UDim2.new(0, 100,0,math.random()),"Out","Linear",0.05,false)
wait(0.2)
end
NUM1:TweenSize(UDim2.new(0, 100,0,math.random(-800,0)),"Out","Linear",0.05,false)
If you're the equalizer guy, I wrote you a demo;
-- Put a LocalScript in to a ScreenGui
local num_bars = 30
-- How many bars?
local bar_width = 20
local container_color = BrickColor.new("Institutional white")
local bar_color = BrickColor.new("Really black")
local max_bar_height = 200
local min_bar_height = 3
local tween_speed = .5
-- How fast they go up and down
-- Just something that creates the GUI's
local function create(instanc)
return function(info)
local new = Instance.new(instanc)
for i,v in pairs(info) do
new[i] = v
end
return new
end
end
-- This is your background
local container = create("Frame")
{
Size = UDim2.new(0,(num_bars*bar_width) + num_bars,0,max_bar_height);
Position = UDim2.new(.5,-((num_bars*bar_width)/2),.5,-(max_bar_height/2));
BackgroundTransparency = 0;
BackgroundColor = container_color;
BorderSizePixel = 3;
Parent = script.Parent
}
-- These are your bars
for i = 1, num_bars do
local bar = create("Frame")
{
Size = UDim2.new(0,bar_width,0,0);
Position = UDim2.new(0,((i-1)*bar_width) + i,0,container.Size.Y.Offset);
Name = "bar"..i;
BorderColor = container_color;
BorderSizePixel = padding;
BackgroundColor = bar_color;
Parent = container
}
-- This runs more than one while statement at once
Spawn(function()
while true do
local random_size_y = math.random(min_bar_height, max_bar_height)
bar:TweenSize(UDim2.new(0,bar_width,0,-random_size_y),"Out", "Linear", tween_speed, true)
wait(tween_speed)
end
end)
end
I'm on too late to answer questions, just got be quicker..
What?
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Are you the person that was asking about the music - equalizer GUI thing a min ago?