Script playing 2 sounds when talking

So I edited the script provided by @Valkyrop. I’m making it if the sound that i’m choosing plays 2 times. , the player get kicked from the game. However there is two sounds playing. Which is not what I wanted. I don’t know how to fix this

local Replicated = game:GetService("ReplicatedStorage")

local Player = game:GetService("Players").LocalPlayer

Player.Chatted:Connect(function(message: string)
	local randomMusic =  Replicated.Sounds:GetChildren()[math.random(1,# Replicated.Sounds:GetChildren())]
	if Replicated.Sounds.YE:Play() then
		Player:Kick("You made him sad.")

Anyone can help ?

Thats because you are checking for Replicated.Sounds.YE:Play() which is a function.

So like what do I put instead of it?. I’m not really experienced

If you want to check if its playing then put Replicated.Sounds.YE.Playing instead.