#Still damages me despite my efforts to exclude the ray from the local player

7 messages · Page 1 of 1 (latest)

jovial lance
#

Local Script ----

local Part = script.Parent

local Tool = Part.Parent

local Players = game:GetService("Players")

local Player = Players.LocalPlayer

local Mouse = Player:GetMouse()

local ClickDetector = Part.ClickDetector

local RS = game:GetService("ReplicatedStorage")

local RM = RS.RemoteEvent


local Tool = script.Parent.Parent

Mouse.Button1Down:Connect(function()

local character = Player.Character

if character and character:FindFirstChild("Tool") then
    print("Equipped") 
    
    local raycastParams = RaycastParams.new()
        raycastParams.FilterDescendantsInstances = {Player.Character}
            raycastParams.FilterType = Enum.RaycastFilterType.Exclude
    
    
    local rayOrigin = Part.Position

    local rayDestination = Mouse.Hit.p

    local rayDirection = rayDestination - rayOrigin

    RM:FireServer(rayOrigin, rayDirection, Tool, raycastParams) 
else
    print("Not Yet Equipped!")
end

end)

#

Server Script ----

#

local RS = game:GetService("ReplicatedStorage")

local RM = RS.RemoteEvent

local Players = game:GetService("Players")

local Player = Players.LocalPlayer

RM.OnServerEvent:Connect(function(player, rayOrigin, rayDirection, Tool, raycastParams)

print(player)

        

local damage = Tool:GetAttribute("Damage")
    local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
    


if raycastResult then
    print(raycastResult.Instance.Name)
        local PartHit = raycastResult.Instance.Parent
            local Humanoid = PartHit:FindFirstChild("Humanoid")
                if PartHit:FindFirstChild("Humanoid") then
                    print("Found Humanoid")
                         Humanoid.Health = Humanoid.Health - damage
                            else
        print("Nothing Found")
    end    
end

end)

hybrid prairie
#
lua
#

im not reading allat

lament sierra