.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 )
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.
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)
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.