Why is that happening, that makes 0 sense in my head. Ill send here the part of my code that handles that Ray
-- Ray Casting
local Ray = Ray.new(Spear.Position, Mouse.Hit.p)
Magic.SeeRay(Ray)
local Hit, Positionn = game.Workspace:FindPartOnRay(Ray, Character)
-- Tweening it to the final position
local Tween = TweenService:Create(Spear, TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Position = Positionn})
Mouse.Hit.p is just where the mouse at, I suggest replacing
with
local Ray = Ray.new(Spear.Position, Mouse.Hit.lookVector * 2500 – 2500 can be any number, its just how far the ray will hit, atleast for workspace:Raycast()
lookVector or LookVector works by what direction the CFrame is looking at
Remember that Mouse.Hit is a CFrame
Thanks for you and @HugeCoolboy2007 i didnt know that FindPartOnRay() were Deprecated. now it’s working, what i changed is:
local raycastresult = game.workspace:Raycast(Spear.Position, Spear.CFrame.lookVector*2500)
if raycastresult then
-- Tweening it to the final position
local Tween = TweenService:Create(Spear, TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Position = raycastresult.Position})
-- Creating a Ring
Magic.NewRing("Hie", Spear, 0.3, 30)
-- Shaking the camera
camShake:Shake(CameraShaker.Presets.Explosion)
Tween:Play()
else
return
end
That solved the problem. GIF of how it’s working now: GIF