My fading screen is not working

.This is my very first topic so be as rude and as mean as you can. The only way a person can learn is if they go through hardship.

So I was trying to make a fading screen using a screen gui with a frame inside it with the frame being completely transparent so you couldn’t see the black block.

I then coded it to slowly appear and disappear when an object is touched.
When I tested it out the screen kept flashing. How do I fix it?

Thanks in advance!

(btw i cant support any scripts just to make ur life more harde and becuz i am doing this on a kindle paperwhite )

3 Likes

Hello there and welcome to the forums!

What I suspect could be happening is that maybe the script is trying to set the screen to go to visible and invisible so fast that you only see it flash.

I’d say try going for TweenService
First try to set it to appear, then wait for it to finish and the set for it to disappear

Basically, something like this:

local TweenService = game:GetService("TweenService")
local Frame = --put in the path to your frame here

local info = TweenInfo.new(5) -- this says that the tween will last 5 seconds
local goal1 = {Transparency = 0} -- This says to make it visible
local goal2 = {Transparency = 1} -- This says to make it invisible

local tweenAppear = TweenService:Create(Frame, info, goal1)
local tweenDisappear = TweenService:Create(Frame, info, goal2)

tweenAppear:Play() --play the tween
task.wait(5)
tweenDisappear:Play() -- play the invisible tween

Make sure to put this into the function that is called when the player steps on the part.

3 Likes

What exactly do you want to do? You need to be very descriptive.
What do you mean by this, “btw I cant support any scripts”

1 Like

Not exactly answering your question, but if you’d like to learn more about TweenService I highly recommend the ROBLOX documentation on the matter.

i cant bcuz i am on a kindle paperwhite!!)

can you show the code?? we dont be able to fix it without it

You said you are using touched right?

Your most likely issue is that you aren’t using a debounce, so the touched event gets fired multiple times, causing your tweens to start playing multiple times.

Try something like this

local debounce = false
local object = part -- whatever your part is

object.Touched:Connect(function() 
	if not debounce then
		debounce = true -- set debounce to true so it can't be run again while its already going
		-- run code
		task.wait()
		debounce = false -- code is done running, can be run again if touched
	end
end)

ok now i get it! I was using a repeat and a debounce! I should’ve put the debounce outside of the function! thx a lot!

1 Like

If @doggyshot123 solved the issue then please click the Solution button on his post.
It tells other people that this post was solved, so if they are searching for a similar issue your post will come up with a checkmark.

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