local work = game:GetService("Workspace")
local Records = work:WaitForChild("BoardList")
local Up, Down = Records:WaitForChild("SurfaceGui"):WaitForChild("Up"), Records:WaitForChild("SurfaceGui"):WaitForChild("Down")
local ListFrame = Records:WaitForChild("SurfaceGui"):WaitForChild("PlayersList"):WaitForChild("List")
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local MaxClicks = 50
local RecsClick = 0
local increment = .5
local strdeb = false
Up.MouseButton1Down:Connect(function()
if rdeb then return end
if RecsClick <= 0 then RecsClick = 0 return end
RecsClick = RecsClick - 1
rdeb = true
ListFrame:TweenPosition(ListFrame.Position + UDim2.new(0,0,increment,0), "Out", "Quad", 2, true)
wait(2.5)
rdeb = false
end)
Down.MouseButton1Down:Connect(function()
if rdeb then return end
if RecsClick >= MaxClicks then RecsClick = MaxClicks return end
rdeb = true
RecsClick = RecsClick + 1
ListFrame:TweenPosition(ListFrame.Position - UDim2.new(0,0,increment,0), "Out", "Quad", 2, true)
wait(2.5)
rdeb = false
end)
What’s wrong with this? I don’t understand it’s saying the very second line is yielding for no reason at all.
When you use the :WaitForChild() method of instances you need to consider the possibility that the thing you’re waiting for might never exist. Most of the time it should be there and ready to go almost instantenously.
In your case, I do agree that something could be deleting the board therefore causing an un-intended issue.
If you are anticipating the existence of an object and you have an incling as to how long it may take to exist, you can set a timeout on the :WaitForChild() method and respectively wait a set amount of time before continuing your code. As this does not wait forever, it will continue your current thread after the given time period and the variable you assigned with :WaitForChild() will either be nil (if the object did not replicate / appear in time) or be a reference to object you were waiting for.
Thanks for the help, turned out the issue was I actually had StreamingEnabled on. I wasn’t aware of this, because I haven’t edited the game for a while so I forgot.