【发布时间】:2018-08-09 12:45:50
【问题描述】:
我在 ROBLOX 中制作迷你游戏已经有一段时间了,我的游戏中的一件事是在选择游戏时出现滚动效果。你可以看到我在说什么here。同样在这个 gif 中,你可以看到我的问题。效果从下到上滚动。它应该从上到下。
我真的不明白它为什么会这样,所以我不确定该怎么做。
这是负责效果的代码:
for i, v in pairs(P:GetChildren()) do
local ll
local lastpicked
local t = P:GetChildren()
local menuItems = #t -- number of menu items
local repeats = 1 -- Repeated
for R = math.random(65,95) + math.random(menuItems), 1, -1 do
ll = t[repeats].SurfaceGui.TextLabel
local lastbcolor = ll.BackgroundColor3
ll.BackgroundColor3 = BrickColor.Yellow().Color
wait( R^-.7*.7 ) --
ll.BackgroundColor3 = lastbcolor
repeats = repeats % menuItems + 1
end
ll = t[repeats].SurfaceGui.TextLabel
for R = 1, 5 do
local lastbcolor = ll.BackgroundColor3
ll.BackgroundColor3 = BrickColor.new("Bright green").Color
wait( .3 )
ll.BackgroundColor3 = lastbcolor
lastpicked = ll
map = maps:FindFirstChild(ll.Text):Clone()
wait( .3 )
end
break
end
【问题讨论】:
-
您在列表中从元素 1 循环到 #t,因此您的菜单项很可能只是以这种方式排序。没有看到你的菜单实现就无法回答这个问题。
-
菜单的顺序是正确的。我已经确定了这一点。顶部菜单项位于列表顶部,并且在资源管理器层次结构的顶部以及其余菜单项。