How To Make Sound Play Only 1 Time?

  1. What do you want to achieve? Make my script play the music 1 time only.

  2. What is the issue? My script plays a music 100 times instead of only 1 time.

  3. What solutions have you tried so far? I tried to look at dev Hub but nothing.

while wait() do
	local Player = game:GetService("Players")
	local player = Player.LocalPlayer
	local power = script.Parent


	if script.Parent.Value == 43 then
		local kills5 = Instance.new("Sound",player.Character.Humanoid.Torso)
		kills5.SoundId = "rbxassetid://10636340314"
		kills5.Looped = true
		kills5.Volume = 2.2
		kills5:Play()
		player.Character.Humanoid.WalkSpeed = 28
	end

	if script.Parent.Value == 66 then
		local kills10 = Instance.new("Sound",player.Character.Humanoid.Torso)
		kills10.SoundId = "rbxassetid://10662472899"
		kills10.Looped = true
		kills10.Volume = 2.2
		kills10:Play()
		player.Character.Humanoid.WalkSpeed = 45


	end


end

What i have to do to play the music 1 time only?

It’s playing fast because it’s in a while wait() loop

then i should remove the While wait() ?

No, put all of the code (remove the while loop) inside of this

local Player = game:GetService("Players")
local player = Player.LocalPlayer
local power = script.Parent

script.Parent.Changed:Connect(function()
      -- if statements here
end)