Function keeps looping somehow

I only want this to run once, but it keeps looping over itself and I have no clue why. Here’s my code and a video.

local ts = game:GetService("TweenService")
local player = game:GetService("Players").LocalPlayer
local REMs = game:GetService("ReplicatedStorage").REMs
local components = {
	script.Parent.MenuBack.OpeningAssets.StudioIntroduction,
	script.Parent.MenuBack,
	script.Parent.MenuBack.UIGradient
}
script.Parent.MenuBack.Username.Text = player.DisplayName.."(@"..player.Name..")"



local tweeninfo1 = TweenInfo.new(
	3,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.In
)

local transText = ts:Create(components[1],
	tweeninfo1, 
	{TextTransparency=1} )

local transColor = ts:Create(components[2],
	tweeninfo1,
	{BackgroundColor3 = Color3.new(255,255,255)}
)

local function intro()
	components[1]:TweenSize(UDim2.new(1,0,0.15,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad, 8)
	transText:Play()
	wait(6)
	components[1]:Destroy()
	transColor:Play()
end

intro()

Could you put it in a better format to read? Like take a screen shot of your code

im so sorry, i accidentally posted it before finishing. how do i make it into a lua block of code?

I don’t really know how to put it in a lua block of code, so I usually take screen shots of my code for help when I use the dev form.

fixed it for you (mmmmmmmmmmmm)

In your TweenInfo1, your missing some info.

image

1 Like

ohhh thank you so much for the help. i didnt know you had to define that lol

wait, that didnt fix it sadly i dont know why

Try using transtext.Completed:Wait()

1 Like

Thanks so much, it works properly now!

oh my god it keeps looping why. it extends to the new part now, but then it just loops over the function again. its as if all the previous changes didnt exist, and it goes back in time to redo them all over again

This is a resize gui that I created inside my game, that works and only runs one time. Im unsure how to help you any further but I hope this example helps a little bit.

1 Like

thanks, i dont even know why thats happening. ive never encountered that before, it might be a bug but id highly doubt it

i just realized why it wasnt working lol. i had intro not connecting to anything, and it was just there infinitely looping over itself

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.