Attack spell help

My script isn’t working its supposed to damage surrounding players and play a noise , as of right now only the sound plays . I was hoping someone could help me fix my script .

local players = game:GetService("Players")
local sound = Instance.new("Sound", game.Workspace)
local damage = 25
sound.SoundId = "rbxassetid://6278267526"
db = false

game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
		if msg == "stridor" and not db then
		db = true
for i,v in pairs(players:GetPlayers()) do

		while true do
						local Character = v.Character or v.CharacterAdded:Wait()
			local humanoidRootPart = Character:WaitForChild('HumanoidRootPart')
						if (Character.HumanoidRootPart.Position).Magnitude <= 30 then
				           sound:Play()
							game.Players.Character.Humanoid:TakeDamage(25)
							
						end
		           end
				end
				wait(14)

				local db = false
				
			end
	    end)
    end)

There are a bunch of problems, but to fix not taking damage just remove game.Players on this line and it should work fine

Thanks for your help , I tried it out and it damaged me instead of nearby players .

yea that was one of the problems. I’ll just list what I’ve spotted so far and try my best to offer fixes, but they might not work since I dont know how you structured your game.

  1. you dont have a wait() inside your while loop so its a miracle how studio didnt freeze and explode
  2. i dont think you even need a while loop in the first place, and the for loop needs some fixes
player.Chatted:Connect(function(msg)
    local plrRoot = player.Character.HumanoidRootPart
    if msg == "stridor" and not db then
        db = true
        for _, otherPlr in pairs(Players:GetPlayers()) do
            local char = otherPlr.Character
            local root = char.HumanoidRootPart
            if otherPlr ~= player and (root.Position - plrRoot.Position).Magnitude <= 30 then
                sound:Play()
                char.Humanoid:TakeDamage(25)
            end
        wait(10)
        db = false
        end
    end
end)

probably has tons of errors since i didnt check this at all