How do I make a thing like SkyBlox where once you are done chatting you can press enter or return and it makes a funny sound. Like if I say “LOL” and enter it will make a funny sound
this should work:
local sound = --location of sound
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg:lower() == "lol" then
sound:Play()
end
end)
end)
1 Like
local SoundBank = {
--["trigger"]={"assetUrl",Volume,{StartTimePosition, EndTimePosition, MaxDistance, PlaybackSpeed}}, Set EndTimePosition to -1 for the full length
["lol"]={"rbxassetid://1551938663" ,1.5,{0.9, 3, 100}},
["hi"]={"rbxassetid://5225818532", {0, -1, 100, 0.69}},
["jeff"]={"rbxassetid://2867856238", 2, {3, 3.91, 100}}
}
local CooldownList = {}
local AllCooldown = 2
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
for i,v in pairs(SoundBank) do
if string.match(msg:lower(), i:lower()) then
local Character = Player.Character or Player.CharacterAdded:Wait()
if Character == nil then continue end
local Head = Character["Head"]
if Head == nil then continue end
local AlreadyExists = nil
for x,c in pairs(CooldownList) do
if c[1] == Player.UserId then
AlreadyExists = x
if (tick() - c[2]) < AllCooldown then
return
end
end
end
if AlreadyExists == nil then
table.insert(CooldownList, {Player.UserId, tick()})
else
CooldownList[AlreadyExists][2] = tick()
end
local Sound = Instance.new("Sound", Head)
Sound.SoundId = v[1]
if v[2] ~= nil then
if type(v[2]) == "number" then
Sound.Volume = v[2]
elseif type(v[2]) == "table" then
v[3] = v[2]
end
end
if v[3] ~= nil then
if v[3][1] ~= nil then
Sound.TimePosition = v[3][1]
end
if v[3][3] ~= nil then
Sound.MaxDistance = v[3][3]
end
if v[3][4] ~= nil then
Sound.PlaybackSpeed = v[3][4]
end
end
if not Sound.IsLoaded then Sound.Loaded:Wait() end
if v[3] ~= nil then
if v[3][2] ~= nil then
Sound:Play()
if v[3][2] <= 0 then
if v[3][4] ~= nil then
game:GetService("Debris"):AddItem(Sound, Sound.TimeLength/v[3][4])
else
game:GetService("Debris"):AddItem(Sound, Sound.TimeLength)
end
else
if v[3][4] ~= nil then
wait((v[3][2] - v[3][1])/v[3][4])
Sound:Destroy()
else
wait(v[3][2] - v[3][1])
Sound:Destroy()
end
end
else
Sound:Play()
game:GetService("Debris"):AddItem(Sound, Sound.TimeLength)
end
else
Sound:Play()
game:GetService("Debris"):AddItem(Sound, Sound.TimeLength)
end
break
end
end
end)
end)
1 Like
what about without using tables. Like any word. Meaning I can type anything and it says
That’s not possible because of Roblox’s limitations; you have to upload the audio file to Roblox and have it be moderated before you can start using it in games.