I have a server side gun script firing the raycast hit part name and it correctly prints the parts name , I also have a server side barrel script that listens for the event and for simplicity sake prints a message if the name of the raycast result is equal to "testPart"
``fire.OnServerEvent:Connect(function(player, mouseHit)
--print("Fire event triggered by", player.Name)
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid")
local rayOrigin = muzzle.Position
--raycast stuff
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if raycastResult then
local hitPart = raycastResult.Instance
local hitPosition = raycastResult.Position
local hitPartName = hitPart.Name -- Ensure this is the name
local hitNormal = raycastResult.Normal
-- Return the name of the hit part to the client
print("Firing event for hit part:", hitPartName)
fire:FireClient(player, hitPartName)
--print(hitPart.Name)
end)``
** You are now Level 5! **