Greetings,
I am trying to make a casting indicator, so that when a player goes to cast a long range spell pressing the keybind spawns a part that indicates the current target of the spell and the projected area of effect,
however I can’t seem to get it to work. I am setting it’s cframe to the point where the ray hit something + the normal
here is how it looks
https://streamable.com/mm9cil
local instance, HitPoint, Normal = RayCast(Origin, Direction, MaxDistance, IgnoreList) – Will goto max distance unless something is hit,
Area:SetPrimaryPartCFrame(CFrame.new(HitPoint, HitPoint + Normal)) if (Area.PrimaryPart.CFrame.p - Root.CFrame.p).Magnitude > 45 then print "max range" Area:SetPrimaryPartCFrame(CFrame.new(Root.Position + HitPoint.Unit * MaxDistance, (Root.Position + HitPoint.Unit * MaxDistance) + Normal)) end
However when it goes out of range instead of stying 45 studs(Max Distance) from the player it just disappears instead. If someone could point out the error i am making i’d be most grateful
Thank you for your time