I want it to able to kill a player but can also kill a zombie free model by roblox
local system = {
["PLAYERNAME"] = nil,
["SELFPLAYERNAME"] = nil
}
system.CAST = function(plr:Player)
local MOUSE = plr:GetMouse()
system.SELFPLAYERNAME = plr.Character.Name
MOUSE.Button1Down:Connect(function()
local SELF = nil
local WORLD_CAMERA = workspace.CurrentCamera
local RAY_PARAMS = RaycastParams.new()
RAY_PARAMS.IgnoreWater = true
RAY_PARAMS.FilterType = Enum.RaycastFilterType.Exclude
RAY_PARAMS.FilterDescendantsInstances = {script.Parent, plr.Character}
local LOOK_CAMERA = WORLD_CAMERA.CFrame.LookVector
local RAY_RESULT = workspace:Raycast(WORLD_CAMERA.CFrame.Position, WORLD_CAMERA.CFrame.LookVector * 23, RAY_PARAMS)
print(RAY_RESULT.Instance.Name)
system.PLAYERNAME = plr.Name
RAY_RESULT.Instance.Color = Color3.new(1,1,1)
if plr.Name == system.SELFPLAYERNAME then
print("|| Not Available ||")
else
system.DAMAGE_PLAYER(plr)
end
end)
end
system.DAMAGE_PLAYER = function(plr:Player)
local CHAR = workspace:WaitForChild(system.PLAYERNAME)
CHAR.Humanoid.Health = 0
end
return system
Thanks in advance