You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
im trying to achieve fnf music gui (simple version) but i need help -
What is the issue? Include screenshots / videos if possible!
the issue is that the order or position is wrong like
^^^^^^^
you can see that the last print was text4 but if you look at the gui
^^^
the position of the frame is at the “TEST” button position -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
nope, nobody
local us = game:GetService("UserInputService")
local tw = game:GetService("TweenService")
local currentIndex = 1
script.Parent.Buttons.Position = UDim2.new(0.145, 0,0.3, 0)
local function move()
local c = script.Parent.Buttons:FindFirstChild(currentIndex)
if c then
local target = c.Position - UDim2.new(0,0,0.1,0)
local tw = TweenInfo.new(0.5)
local g = {}
g.Position = target
print(c.Text)
local tween = tw:Create(script.Parent.Buttons, tw, g)
tween:Play()
end
end
local function onKeyPress(input)
if input.KeyCode == Enum.KeyCode.Down or input.KeyCode == Enum.KeyCode.H then
currentIndex = currentIndex - 1
if currentIndex == 0 then
currentIndex = #script.Parent.Buttons:GetChildren() -- Move to the latest lol
end
move()
elseif input.KeyCode == Enum.KeyCode.Up or input.KeyCode == Enum.KeyCode.G then
currentIndex = currentIndex % #script.Parent.Buttons:GetChildren() + 1
move()
end
end
us.InputBegan:Connect(onKeyPress)
^^ heres the code of the padding
if also needed heres the code of generation
local buttonTexts = {"Bopeebo", "Text2", "Text3", "Text4"}
local lastpos = script.TextButton.Position
for i = 1,4 do
local button = script:WaitForChild("TextButton"):Clone()
button.Parent = script.Parent.Buttons
button.Position = lastpos + UDim2.new(0.005, 0, 0.06, 0)
lastpos = button.Position
button.Name = i
button.Text = buttonTexts[i] or "Unknown"
wait()
end
script.Enabled = false
Note:
i also noticed that the order is also wrong in the frame but i deleted and enabled the regen, it still doenst work