Nope. Just the upper torso of the hostile model.
Nope It won’t. (234587216348791263487123 extra characters so i can send it)
Might you use the following code and see the raycast?
local origin = Hostile.Raycastpoint.Position
local direction = Humanoid.RootPart.Position
local result = workspace:Raycast(origin, direction, rp)
if result then
local distance = (origin - result.Position).Magnitude
local p = Instance.new("Part")
p.Anchored = true
p.CanCollide = false
p.Size = Vector3.new(0.1, 0.1, distance)
p.CFrame = CFrame.lookAt(origin, position)*CFrame.new(0, 0, -distance/2)
end
My assumption is that you’re trying to cast a ray from the enemy towards the player? If so, you need a directional vector, not the instance that you’re trying to point at.
You can find the direction by using this formula:
direction = destination - origin
Also note that you need a length for this direction which can be achieved by multiplying it by how far you want the ray to cast, 50 being 50 studs:
direction = (destination - origin) * 50
So in your case,
local sight = workspace:Raycast(Hostile.Raycastpoint.Position, (Humanoid.RootPart.Position - Hostile.Raycastpoint.Position) * 50, rp)
3 Likes
Nothing happened. (typing extra characters to bypass the min character limit)
Okay, I’ll try that. (more bypassing the min character limit)
That is the solution, Thank you so much!
1 Like