Good afternoon,
For almost a week I’ve tried getting an ad screen script to work. It currently has perfect syntax, refuses to run, and displays no output/errors. The way it works is: there are 10 horizontally placed ImageLabels in a frame. Every 10 seconds, one slides to the next, and at the end the final to the back. Currently, I’ve tried removing duplicates of the exact function and adding a while true do
loop. Here is the script:
--! strict
local frame = script.Parent.Frame
local count = #frame:GetChildren()
local slide = 1
function play()
repeat
frame:TweenPosition(UDim2.new(slide-1,0,0,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 3, false, nil)
task.wait(10)
until
slide == 10
play()
end
while true do play() end
Remove the newline between until
and slide == 10
. Also, you shouldn’t add play()
inside the function. The loop will do it for you.
To debug scripts you should have the output open at all times to prevent issues like this.
Hello,
I keep output open at all times, as you can see in the title there IS no output. This additionally did not work, thank you for trying. It still gives no output, nor does it work.
Can you send a video of what happens?
In that case, I recommend using TweenService
instead of the Gui functions. They’re known to not work with certain tween types. Also, make sure this is a local script.
This script actually doesn’t have to be in a local script, as I think they are using a SurfaceGui.
1 Like
SurfaceGuis should be placed in StarterGui. LocalScripts are ideal here.
For this use case, it cannot be placed in StarterGUI as I need it to be global.
They can be placed under the part they are in, and I think having all of the advertisements always be the same would be good, rather then them being different because of different client start times.
1 Like
I see. Try basing your tween off of DateTime.now
timestamps in that case.
It doesn’t matter if it is in the part. He wants it to work when it is in the part, and he wants the tween to be fixed.
Try using TweenService instead.