I have made a script which when a player touches the part the sound is played, but it doesn't work what should i do?

local part = script.Parent


while true do 
 wait(1)
part.Touched:Connect(function(hit)
	local H = hit.Parent:FindFirstChild("Humanoid")
	if H then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player then
			local leaderstats = player:WaitForChild("leaderstats")
			local currency = leaderstats.Cash
			local Selling = leaderstats.EPoints
			if Selling.Value > 0 then
				
				part.Cash:Play()
			
			end
		end
	end
end)

1 comment

0

NVM I JUST REALISED I DID NOT NEED THE WHILE LOOP