Server side:
game.ReplicatedStorage.FireEvent.OnServerEvent:Connect(function(plr,pos,origPos,dmg)
print('d')
local e = RaycastParams.new()
e.FilterDescendantsInstances = {plr.Character}
e.FilterType = Enum.RaycastFilterType.Blacklist
e.IgnoreWater = false
local rayDirection = origPos - pos
local raycastResult = workspace:Raycast(origPos, rayDirection, e)
if raycastResult then
print('e')
local hitPart = raycastResult.Instance
local hitParent = hitPart:FindFirstAncestorOfClass('Model')
local hum = hitParent:FindFirstChild('Humanoid')
hum.Health = hum.Health - dmg
end
end)
Client side:
script.Parent.Activated:Connect(function()
script.Parent.FiredSound:Play()
print('a')
game.ReplicatedStorage.FireEvent:FireServer(game.Players.LocalPlayer:GetMouse().Hit.p,game.Players.LocalPlayer.Character.RightHand.Position, script.Parent.Config.Damage.Value)
end)
Problem:
The script usually only prints to d
, meaning it isn’t raycasting.