Ui stroke won't fade out

Hello. im trying to make a subtitle script but when it fades out the ui stroke comes back when it just faded out and i can’t see a solution so help is very appreciated.

Here is a video of what happens:
https://gyazo.com/e18a54e4eba67e3db4d0dabb0bf37557

Here is my script:

function onClicked(onClicked)
	local frame = script.Parent
	local frameStroke = script.Parent.UIStroke
	game.Workspace.House.LivingRoom:WaitForChild("TV remote"):FindFirstChild("ClickPart").Sound:Play()

	for i = 1,40 do
		frame.TextTransparency -= 0.1
		frameStroke.Transparency -= 0.1
		wait(0.01)
	end
	wait(3)
	for i = 1,40 do
		frame.TextTransparency += 0.1
		frameStroke.Transparency += 0.1
		wait(0.01)
	end
end


game.Workspace.House.LivingRoom:WaitForChild("TV remote"):FindFirstChild("ClickPart").ClickDetector.MouseClick:Connect(onClicked)
2 Likes

Quick questions do you want it to “fade out” for every client or only one client who clicked?
If you want it for the client who clicked you’d have to parent the frame to PlayerGui instead.

1 Like

its in a local script and the script is under the textlabel so it should only show up for the client

Then you would have to parent it to playergui.

SCREENGUIHERE.Parent = LocalPlayer:WaitForChild("PlayerGui") -- This has to be in a localscript inside the screengui so basically like local SCREENGUIHERE = script.Parent
1 Like

GUIs in StarterGui are automatically parented to PlayerGui, your basically doing it twice if you execute that code. And your waiting for PlayerGui, which is basically already loaded in the first seconds of loading.

1 Like

This is off topic but nice game also

1 Like

nvm found a solution


1 Like

doors inspired game? it looks pretty awesome ngl

2 Likes

yes it is very inspired by doors but instead of going through doors then its like a horror story like the mimic and other games

1 Like