Please help with script

local A_1 = game:GetService("Workspace").Characters.Player.Head
local A_2 = Vector3.new(74.12516784667969, 163.12762451171875, -525.1954956054688)
local A_3 = Vector3.new(0, 0, -1)
local A_4 = Enum.Material.Plastic
local A_5 = CFrame.new(-0.250976562, 0.891113281, -0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
local A_6 = game:GetService("Players").LocalPlayer.Character.Spear
local Event = game:GetService("ReplicatedStorage").Assets.Remotes.hitMelee
Event:FireServer(A_1, A_2, A_3, A_4, A_5, A_6)

I don’t know how to take all the characters and their heads

local A_1 = game:GetService("Workspace").Characters.Player.Head

I’m having problems because of this line.

for i, v in pairs(game.Players:GetPlayers())

local A_1 = v.Character.Head

local A_2 = Vector3.new(74.12516784667969, 163.12762451171875, -525.1954956054688)
local A_3 = Vector3.new(0, 0, -1)
local A_4 = Enum.Material.Plastic
local A_5 = CFrame.new(-0.250976562, 0.891113281, -0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
local A_6 = game:GetService("Players").LocalPlayer.Character.Spear
local Event = game:GetService("ReplicatedStorage").Assets.Remotes.hitMelee
Event:FireServer(A_1, A_2, A_3, A_4, A_5, A_6)

end)

I dont know if it works

wow its works but I need him to kill everyone at once and not one by one

for i, v in pairs(game.Players:GetPlayers()) do

task.spawn(function()
local A_1 = v.Character.Head

local A_2 = Vector3.new(74.12516784667969, 163.12762451171875, -525.1954956054688)
local A_3 = Vector3.new(0, 0, -1)
local A_4 = Enum.Material.Plastic
local A_5 = CFrame.new(-0.250976562, 0.891113281, -0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
local A_6 = game:GetService("Players").LocalPlayer.Character.Spear
local Event = game:GetService("ReplicatedStorage").Assets.Remotes.hitMelee
Event:FireServer(A_1, A_2, A_3, A_4, A_5, A_6)
end)
end)

EDIT
You can try again.
@3EloHIyChay123123

This should kill at once i think u have a wait in your other Script where your Fire the Event to

Без имени

for i, v in pairs(game.Players:GetPlayers()) do

task.spawn(function()
local A_1 = v.Character.Head

local A_2 = Vector3.new(74.12516784667969, 163.12762451171875, -525.1954956054688)
local A_3 = Vector3.new(0, 0, -1)
local A_4 = Enum.Material.Plastic
local A_5 = CFrame.new(-0.250976562, 0.891113281, -0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
local A_6 = game:GetService("Players").LocalPlayer.Character.Spear
local Event = game:GetService("ReplicatedStorage").Assets.Remotes.hitMelee
Event:FireServer(A_1, A_2, A_3, A_4, A_5, A_6)
end)
end

This should fix it

1 Like