local remote = game.ReplicatedStorage:WaitForChild("spellsRemote"):WaitForChild("auraAttackRemote")
remote.OnServerEvent:Connect(function(player)
print("firedddd")
local auraAttckClone = game.ServerStorage:WaitForChild("auraAttack"):Clone()
print("cloned")
auraAttckClone.CFrame = player.Character.HumanoidRootPart.CFrame * Vector3.new(0,5,0)
auraAttckClone.Parent = workspace
local humanoids = workspace:GetChildren()
for i,v in ipairs(humanoids) do
if v:FindFirstChild("Humanoid") and v:FindFirstChild("Humanoid") ~= player.Character.Humanoid then
local enemy = v;
local range = (player.Character.HumanoidRootPart.CFrame.Position - enemy.HumanoidRootPart.CFrame.Position).Magnitude
if range < 20 then
enemy.Humanoid:TakeDamage(50)
game:GetService("Debris").addItem(auraAttckClone,4)
end
end
end
end)
The part is not appearing and no errors are showing. Remote event is sucessfully fired using local script form starterplayer scripts but onServerEvent is not picking up, I have no erroreees. Hwelp!
Why’re you trying to find the humanoid
when you have done “workspace:GetChildren()”
Also cleaned the code a bit:
local replicatedStorage = game:GetService("ReplicatedStorage")
local serverStorage = game:GetService("ServerStorage")
local remoteEvent = replicatedStorage.spellsRemote.auraAttackRemote
remoteEvent.OnServerEvent:Connect(function(player)
local character = player.Character
local humanoidRootPart = character.HumanoidRootPart
local clone = serverStorage.auraAttack:Clone()
clone.CFrame = humanoidRootPart.CFrame * Vector3.new(0, 5, 0)
clone.Parent = game.Workspace
for i, v in pairs(game.Workspace:GetChildren()) do
end
end)
local remote = game.ReplicatedStorage:WaitForChild("spellsRemote"):WaitForChild("auraAttackRemote")
remote.OnServerEvent:Connect(function(player)
print("firedddd")
local auraAttckClone = game.ServerStorage:WaitForChild("auraAttack"):Clone()
print("cloned")
auraAttckClone.Anchored = true
auraAttckClone.Position = player.Character.HumanoidRootPart.Position + Vector3.new(0,5,0)
auraAttckClone.Parent = workspace
for i,v in game:GetSevrice("Players"):GetPlayers() do
if v.Name ~= player.Name then
local enemy = v.Character
local range = (player.Character.HumanoidRootPart.Position - enemy.HumanoidRootPart.Position).Magnitude
if range < 20 and enemy:FindFirstChild("Humanoid").Health > 0 then
enemy.Humanoid:TakeDamage(50)
game:GetService("Debris").addItem(auraAttckClone,4)
end
end
end
end)```
local remote = game.ReplicatedStorage:WaitForChild("spellsRemote"):WaitForChild("auraAttackRemote")
remote.OnServerEvent:Connect(function(player)
print("firedddd")
local auraAttckClone = game.ServerStorage:WaitForChild("auraAttack"):Clone()
print("cloned")
print(auraAttckClone.Name)
print((player.Character.HumanoidRootPart.Position - auraAttckClone.Position).Magnitude)
auraAttckClone.Anchored = true
auraAttckClone.Position = player.Character.HumanoidRootPart.Position + Vector3.new(0,5,0)
auraAttckClone.Parent = workspace
for i,v in game:GetSevrice("Players"):GetPlayers() do
if v.Name ~= player.Name then
local enemy = v.Character
local range = (player.Character.HumanoidRootPart.Position - enemy.HumanoidRootPart.Position).Magnitude
if range < 20 and enemy:FindFirstChild("Humanoid").Health > 0 then
enemy.Humanoid:TakeDamage(50)
game:GetService("Debris").addItem(auraAttckClone,4)
end
end
end
end)```
local remote = game:GetService("ReplicatedStorage").spellsRemote.auraAttackRemote
remote.OnServerEvent:Connect(function(player)
print("firedddd")
local auraAttckClone = game.ServerStorage:WaitForChild("auraAttack"):Clone()
print("cloned")
print(auraAttckClone.Name)
print((player.Character.HumanoidRootPart.Position - auraAttckClone.Position).Magnitude)
auraAttckClone.Anchored = true
auraAttckClone.Position = player.Character.HumanoidRootPart.Position + Vector3.new(0,5,0)
auraAttckClone.Parent = workspace
for i,v in game:GetService("Players"):GetPlayers() do
if v.Name ~= player.Name then
local enemy = v.Character
local range = (player.Character.HumanoidRootPart.Position - enemy.HumanoidRootPart.Position).Magnitude
if range < 20 and enemy:FindFirstChild("Humanoid").Health > 0 then
enemy.Humanoid:TakeDamage(50)
game:GetService("Debris").addItem(auraAttckClone,4)
end
end
end
end)