Hey,
i’m trying to make a soundboard system to make the game a bit more fun. So I made a script with the following content :
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
game:GetService("Players").PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg) --event that activating when player send message
if msg == "/halt" and player.Team == Teams.NTF then
local Sound = Instance.new("Sound")
Sound.Parent = player.PlayerGui
Sound.Name = "TestSound"
Sound.SoundId = "rbxassetid://4657749134" -- Put here your soundid
Sound.RollOffMode = Enum.RollOffMode.Linear
Sound.MaxDistance = 10
Sound:Play()
Sound.Ended:Wait()
Sound:Destroy()
elseif msg == "/fbi" then
local Sound = Instance.new("Sound")
Sound.Parent = player.PlayerGui
Sound.Name = "TestSound"
Sound.SoundId = "rbxassetid://4964334807" -- Put here your soundid
Sound.RollOffMode = Enum.RollOffMode.Linear
Sound.MaxDistance = 10
Sound:Play()
Sound.Ended:Wait()
Sound:Destroy()
elseif msg == "/wow" then
local Sound = Instance.new("Sound")
Sound.Parent = player.PlayerGui
Sound.Name = "TestSound"
Sound.SoundId = "rbxassetid://1460707372" -- Put here your soundid
Sound.RollOffMode = Enum.RollOffMode.Linear
Sound.MaxDistance = 10
Sound:Play()
Sound.Ended:Wait()
Sound:Destroy()
elseif msg == "/alert" then
local Sound = Instance.new("Sound")
Sound.Parent = player.PlayerGui
Sound.Name = "TestSound"
Sound.SoundId = "rbxassetid://1011639456" -- Put here your soundid
Sound.RollOffMode = Enum.RollOffMode.Linear
Sound.MaxDistance = 10
Sound:Play()
Sound.Ended:Wait()
Sound:Destroy()
elseif msg == "/nice" then
local Sound = Instance.new("Sound")
Sound.Parent = player.PlayerGui
Sound.Name = "TestSound"
Sound.SoundId = "rbxassetid://2846571251" -- Put here your soundid
Sound.RollOffMode = Enum.RollOffMode.Linear
Sound.MaxDistance = 10
Sound:Play()
Sound.Ended:Wait()
Sound:Destroy()
end
end)
end)
Problem is that it plays the sound for only one person (client side). I want to it play for everyone.