Im trying to figure out whats wrong with my script , Im making an attack and when you say the spell its damages nearby players and plays a screaming noise
I’ve been testing out Magnitude but it isnt going how i planned . Also the noise isnt playing either , there are no errors .
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.CharacterAdded:Connect(function(Character)
Player.Chatted:Connect(function(msg)
if msg == "stridor" and not db then
db = true
for i, v in pairs(players:GetPlayers()) do
local char = v.Character or v.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
if v:FindFirstChild("HumanoidRootPart") and v:FindFirstChild("Humanoid") then
if v ~= char then
if (v.HumanoidRootPart.Position - char.HumanoidRootPart.Position).Magnitude <= 15 then
if sound.IsLoaded then
sound.Loaded:wait()
v.Humanoid:TakeDamage(34)
end
end
end
end
wait(14)
local db = false
end
end
end)
end)
end)
If anyone could help or give me advice that would be greatly appreciated .