game.Players.PlayerAdded:Connect(function(player)
local sounds = game.ReplicatedStorage:WaitForChild('TextToSpeechSounds')
local totalsounds = game.ReplicatedStorage:WaitForChild('TextToSpeechSounds'):GetChildren()
print(#totalsounds .. ' sounds loaded!')
player.Chatted:Connect(function(msg)
local hastag = string.gmatch('#',filtered)
if hastag then
warn 'String flitered, canceling'
else
end
end)
end)
Oh, and in this else that's where I am stuck on. I'm guessing I would get the order of the letters then do string.sub, maybe?
This is something I am every interested in and have my my own attempts at, currently my script can only make basic 1 word sounds but maybe you can use some parts of it. So I will leave it here.
I put this on a server in ServerScript with a sound object attached
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
print(Player.Name, Message)
if Message == "hello" then
local helloThereAud = Instance.new("Sound")
helloThereAud.Parent = Player
helloThereAud.SoundId = "rbxassetid://4552859397" -- replace with 4552859397 once it loads
helloThereAud.PlayOnRemove = true
helloThereAud:Destroy()
elseif Message == "Hello" then
local helloThereAud = Instance.new("Sound")
helloThereAud.Parent = Player
helloThereAud.SoundId = "rbxassetid://4552859397"
helloThereAud.PlayOnRemove = true
helloThereAud:Destroy()
elseif Message == "Hello there" then
local helloThereAud = Instance.new("Sound")
helloThereAud.Parent = Player
helloThereAud.SoundId = "rbxassetid://4550215560"
helloThereAud.PlayOnRemove = true
helloThereAud:Destroy()
elseif Message == "hello there" then
local helloThereAud = Instance.new("Sound")
helloThereAud.Parent = Player
helloThereAud.SoundId = "rbxassetid://4550215560"
helloThereAud.PlayOnRemove = true
helloThereAud:Destroy()
elseif Message == "goodbye" then
local helloThereAud = Instance.new("Sound")
helloThereAud.Parent = Player
helloThereAud.SoundId = "rbxassetid://4550217403"
helloThereAud.PlayOnRemove = true
helloThereAud:Destroy()
elseif Message == "Goodbye" then
local helloThereAud = Instance.new("Sound")
helloThereAud.Parent = Player
helloThereAud.SoundId = "rbxassetid://4550217403"
helloThereAud.PlayOnRemove = true
helloThereAud:Destroy()
end
end)
end)
Hopefully some part of that could be of use to you as I am very interested in this project, as OutPost 84 have been one of my favorite proof of concept places.
Thanks for the reply, but I don’t want to do the entire dictionary using elseif. So I’m thinking getting the order of the letters the using string.sub, but I’m not sure how that would work. Oh and also, if you do this system then the could type hello many different ways like hElLo or HELLO or HELLO : D or HELLLO HELlo and so on. So using syllable sounds might work better.
oh yeah I know that, I just wanted to see if any of the code at all could be helpful. What you want to do is million times more advanced than my basic script, just seeing if anything sparks idea as I really want to see more text to speech done in Roblox.
Also if you were to have sounds pronounced differently in cases were the string is UpperCase or lowercase, string patterns are a great thing to look into if you haven’t already