RemoteEvent.OnServerEvent:connect(function(play, mouse)
local ray = Ray.new(handle.Position,(mouse.p - handle.Position).unit * 999)
local impact = Instance.new("Part",workspace)
wait()
table.insert(IgnoreParts, impact)
local hit,Position = workspace:FindPartOnRayWithIgnoreList(ray, IgnoreParts)
impact.Size = Vector3.new(1,1,1)
impact.Transparency = 1
impact.Anchored = true
impact.CanCollide = false
impact.CFrame = mouse
local a1 = Instance.new("Attachment", handle)
local a0 = Instance.new("Attachment", impact)
local trail = Instance.new("Beam", impact)
trail.Segments = 0
trail.Width1 = 0.1
trail.Width0 = 0.1
trail.FaceCamera = true
trail.Color = ColorSequence.new(Color3.new(255,255,255))
trail.Attachment0 = a0
trail.Attachment1 = a1
trail.Transparency = NumberSequence.new(0)
if hit then
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= tool.Parent.Name then
if debounce == true then debounce = false
hit.Parent.Humanoid:TakeDamage(30)
if hit.Parent.Humanoid.Health <= 0 then
game.Players:GetPlayerFromCharacter(tool.Parent).leaderstats.GlobalKills = game.Players:GetPlayerFromCharacter(tool.Parent).leaderstats.GlobalKills + 1
end
wait(0.05)
debounce = true
end
end
end
handle.Sound:Play()
handle.Flash:Emit(1)
handle.PointLight.Enabled = true
tool.GripPos = tool.GripPos + Vector3.new(0,0,0.3)
wait(0.1)
tool.GripPos = tool.GripPos + Vector3.new(0,0,-0.3)
a1:Destroy()
a0:Destroy()
handle.PointLight.Enabled = false
game:GetService("Debris"):AddItem(impact, 0.05)
end)
I don’t know how to make this start ignoring accessories. It does work on people’s bodies which aren’t blocked by accessories though.
I’ve already looked at other topics that talk about this but they doesn’t really apply to me because of the way I wrote this code. Maybe I was just not looking hard enough. Let me know, please.