#loading screen
1 messages · Page 1 of 1 (latest)
local function fade_gui_out()
leave.Active = false
--LAGFGG GSPIKE END IT
local clok = os.clock()
for _, obj in gui:GetDescendants() do
if obj:IsA("TextLabel") or obj:IsA("TextButton") then
TweenService:Create(obj, tinfo, {TextTransparency = 1}):Play()
elseif obj:IsA("ImageLabel") or obj:IsA("ImageButton") then
TweenService:Create(obj, tinfo, {ImageTransparency = 1}):Play()
elseif obj:IsA("Frame") then
TweenService:Create(obj, tinfo, {BackgroundTransparency = 1}):Play()
end
end
warn("1: ", tostring(os.clock() - clok))
task.wait(tinfo_duration + 0.2)
RunService.PostSimulation:Wait()
gui.Enabled = false
RunService.PostSimulation:Wait()
gui.Parent = nil
RunService.PostSimulation:Wait()
gui:Destroy()
print("ok u can stop")
end```
the code i sent is currently using runservice.postsimulation because i kept alternating between task.wait, runservice.prerender and other stuff i thought would help not spike it
commenting out both the .parent = nil line and the :destroy one will solve the spike
btw the for loop doesn't cause any spikes whatsoever and it isn't an external script causing this; the warn() printed 1: 0.00007920000643935055
let me summarize this first
can you show me the loading screen UI so i can know more
by code
am not too good at scripting and UI but let me summarize by using my stupad kid ahh brain
actually no, i'll just record and crop the part where it spikes
ok
oh yeah i forgot to see it :Skull:
hang on let me go seeing the issue (lag spike of the UI when clicking or the moving thing but let me see first)
oh i can see
the output
this might take a while to let me see the issue
make it a server script
well so this kind of you need to use a CanvasGroup
you can control it the transparency for the entire group with group transparency
but if using a canvasgroup
its like uhh not really fixing the issue
you can put a local script inside the UI
if you cant use a canvsgroup
you can control the transparency of the entire gui object using the canvas group instance?
try allat without the postsimulation:wait
still spikes
but
i found out that it only spikes in studio
not in the actual game
so thats the first good thing
but are you trying to fix the lag spike in studio and also the actual ame
i thought it'd spike in the game too
and also i dont think the canvas group would work
for avoiding the getdescendants loop
yeah so thats why i said canvasgroup dont really work
holy shit
canvas group is revolutionary
ill use that instead of looping through the descendants
thank you very very very much
saved me 0.007s and prolly a lot of memory
uh yeah i use that a lot in a lot of UIS
** You are now Level 6! **
yes
it works for all sorts of stuff
i cant use it
oh
ive never had to use it
wait why?
not everyone use microprofiler
and therefore didnt familiarize myself with it
i tried to
no spikes were showing up though
-# no spikes on ANY profiler service / thing
how
;-;
how
wanna add me
this happens when u destroy a script on studio i think
same thing happended to me
u get a lag spike
this would actually explain so many things
i've just closed studio 'cause i need to go, i'll try it out tomorrow
thanks for the tip