hi, for some reason the sound is not playing even in the script heres the script:
wait(10)
script.Parent.Visible = true
wait(1)
repeat
script.Parent.Frame.BackgroundTransparency += 0.1
wait(0.1)
until script.Parent.Frame.BackgroundTransparency == 1
game.Workspace:WaitForChild("ds").Screen2.Startup:Play()
repeat
script.Parent.Frame.BackgroundTransparency -= 0.1
wait(0.1)
until script.Parent.Frame.BackgroundTransparency == 0
sound can play if its inside the workspace or soundservice (only client tho)
nowodev
(Nowoshire)
May 17, 2025, 3:19pm
3
Your code runs into a floating point precision error, simply put, your loops will never stop because the logical condition never resolves to true
(0.9999999999999999 is not equal to 1)
Look into using TweenService to accomplish your fading animation instead.
2112Jay
(2112Jay)
May 17, 2025, 3:20pm
4
The sound is most likely in the wrong place…
also… for loops are great for things like a fades
local rns=game:GetService("RunService")
function FadeOut(obj, duration)
for i=1,duration,1 do
obj.BackgroundTransparency =i/duration rns.Stepped:Wait()
end obj.BackgroundTransparency =1
end
function FadeIn(obj, duration)
for i=duration,1,-1 do
obj.BackgroundTransparency =i/duration rns.Stepped:Wait()
end obj.BackgroundTransparency =0
end
nowodev
(Nowoshire)
May 17, 2025, 3:22pm
5
That is not the issue.
Sounds can be played with Sound:Play()
if they’re a descendant of game
.
1 Like
hi ok so i tried it but it not working i am also transparyncing a gui frame here is script
local tweenser = game:GetService("TweenService")
local Tweentransparency = tweenser:Create(script.Parent.Frame, TweenInfo.new(3), {BackgroundTransparency = 0})
wait(10)
script.Parent.Visible = true
wait(1)
Tweentransparency:Play()
game.Workspace:WaitForChild("ds").Screen2.Startup:Play()
repeat
script.Parent.Frame.BackgroundTransparency -= 0.1
wait(0.1)
until script.Parent.Frame.BackgroundTransparency == 0
2112Jay
(2112Jay)
May 17, 2025, 3:28pm
7
The issue is, it’s never leaving the loop before the play call.
So I offered a for loop that will and that will fix the sound problem.
nowodev
(Nowoshire)
May 17, 2025, 3:29pm
8
The issue is, it’s never leaving the loop before the play call.
Yes, that is what I said.
1 Like
nowodev
(Nowoshire)
May 17, 2025, 3:36pm
10
Try this code:
-- Services --
local TweenService = game:GetService("TweenService")
-- Constants
local UI = script.Parent
local TWEENINFO = TweenInfo.new(1)
local SOUND = workspace:WaitForChild("ds"):WaitForChild("Screen2"):WaitForChild("Startup")
task.wait(10)
UI.Visible = true
task.wait(1)
TweenService:Create(UI.Frame, TWEENINFO, {BackgroundTransparency = 1}):Play()
task.wait(1)
SOUND:Play()
TweenService:Create(UI.Frame, TWEENINFO, {BackgroundTransparency = 0}):Play()
3 Likes
thank you so much this actually worked
nowodev
(Nowoshire)
May 17, 2025, 3:37pm
12
I never mentioned TweenService being an absolute must, I suggested it as it is a service made for animations like these.
system
(system)
Closed
May 31, 2025, 3:42pm
14
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.