local Char = script.Parent
local SoundFolder = game.ServerStorage.DeathSounds
local Sounds = SoundFolder:GetChildren()
local Humanoid = Char:WaitForChild("Humanoid")
local HumanoidRootPart = Char:WaitForChild("HumanoidRootPart")
Humanoid.Died:Connect(function()
local ChosenSound = Sounds[math.random(1,#Sounds)]:Clone()
ChosenSound.Parent = HumanoidRootPart
ChosenSound:Play()
HumanoidRootPart:WaitForChild("Died"):Destroy()
end)
Hi all, this is a script I have for a random death sound, where on death, a sound from the DeathSounds folder plays.
How should I make this script check if the player who dies is on a specific team for the script to work? This script is located in StarterCharacterScripts