But it’s not working for some reason and here is the code that I have;
local WhiteBar = Frame.WhiteBar
local HitBox = RedArrow.HitBox
local ActiveArrow = Instance.new('StringValue'); ActiveArrow.Value = 'Active'
local WhiteBarPosMin, WhiteBarPosMax = WhiteBar:GetAttribute('PositionSizeMin'), WhiteBar:GetAttribute('PositionSizeMax')
local WhiteBarSizeMin, WhiteBarSizeMax = WhiteBar:GetAttribute('SizeYMin'), WhiteBar:GetAttribute('SizeYMax')
local RandomPosition = Random.new():NextNumber(WhiteBarPosMin, WhiteBarPosMax)
local RandomSize = Random.new():NextNumber(WhiteBarPosMin, WhiteBarSizeMax)
WhiteBar.Size = UDim2.new(0.508, 0, RandomSize, 0)
WhiteBar.Position = UDim2.new(0.5, 0, RandomPosition, 0)
task.spawn(function()
coroutine.wrap(function()
while ActiveArrow.Value == 'Active' do
for i = 0.02, 0.92, 0.01 do
local Position = UDim2.new(1.348, 0, i, 0)
RedArrow.Position = Position
task.wait()
end
for i = 0.92, 0.02, -0.01 do
local Position = UDim2.new(1.348, 0, i, 0)
RedArrow.Position = Position
task.wait()
end
end
end)()
end)
PressButton.MouseButton1Click:Connect(function()
WhiteBar.Size = UDim2.new(0.508, 0, RandomSize, 0)
WhiteBar.Position = UDim2.new(0.5, 0, RandomPosition, 0)
end)
[Note: This code is inside of a ModuleScript and everything works besides the position randomizer after clicking the button.]
UDim2.new(0.508, 0, RandomSize, 0) would become UDim2.fromScale(0.508, RandomSize) UDim2.new(0.5, 0, RandomPosition, 0) would become UDim2.fromScale(0.5, RandomPosition)