Hey everyone! So what I am trying to achieve is my game has a loading screen, and in this loading screen there is a type-writer effect which is basically a textlabel with a script in it. The problem is, the script is timed so you can’t spend more than a minute in the main menuwithout the type-writer sound going off in the background without the actual text itself.So what I’ve done is disable that script inside that textlabel and when you click the button which opens the loading screen,that script is supposed to be enabled not disabled.
local Textlabel = script.Parent.Parent.Parent.FFrame.TextLabel
local Script = script.Parent.Parent.Parent.FFrame.TextLabel.Script
script.Parent.MouseButton1Click:Connect(function()
if Script.ClassName == "Script" and Script.Name == "Script" then
Script.Disabled = false
end
end)
I tried the script you sent me and it unfortunately didn’t solve the issue, By the way, the code inside the disabled script inside TextLabel is this:
local TextLabel = script.Parent
local Text
function SoundEffect()
local Sound = Instance.new("Sound", workspace)
Sound.Name = "TextSound"
Sound.SoundId = "http://www.roblox.com/asset/?id=3333976425"
Sound.PlaybackSpeed = 1
Sound.Volume = 1
Sound:Play()
coroutine.resume(coroutine.create(function()
wait(1)
Sound:Destroy()
end))
end
function setText(word)
Text = word
for i = 1, #Text do
TextLabel.Text = string.sub(Text, 1, i)
SoundEffect()
TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
wait(0.04)
end
end
wait(10)
setText("Hi there")
wait(2)
setText("You are a S.E.C.U.R.O guard at this hotel")
wait(3)
setText("Your job is to fix anything out of the ordinary")
wait(3)
setText("Make sure to report issues in the S.E.C.U.R.O app")
wait(3)
setText("You will be provided with cameras, and a stock PC")
wait(3)
setText("Don't die.")
local TextLabel = script.Parent
local Text
function SoundEffect()
local Sound = Instance.new("Sound", workspace)
Sound.Name = "TextSound"
Sound.SoundId = "http://www.roblox.com/asset/?id=3333976425"
Sound.PlaybackSpeed = 1
Sound.Volume = 1
Sound.Looped = true
return Sound
end
function setText(word)
Text = word
local Sound = SoundEffect()
Sound:Play()
for i = 1, #Text do
TextLabel.Text = string.sub(Text, 1, i)
TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
wait(0.04)
end
Sound:Stop()
Sound:Destroy() -- get rid of the sound effect
end
wait(10)
setText("Hi there")
wait(2)
setText("You are a S.E.C.U.R.O guard at this hotel")
wait(3)
setText("Your job is to fix anything out of the ordinary")
wait(3)
setText("Make sure to report issues in the S.E.C.U.R.O app")
wait(3)
setText("You will be provided with cameras, and a stock PC")
wait(3)
setText("Don't die.")
So what I did was:
Re-organize the SoundEffects() function (which now uses Sound.Looped = true).
Then after the word is fully typed out, the sound will :Stop() and then be removed.
Maybe instead of using a server script and disabling and enabling it replace it with a local script, this is because the client cant see server scripts! If you do that it should work just fine!
I changed it so that instead of server script, it’s a local script, and when I defined it in the textbutton local script, it seems to function correctly. Thanks!