You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
A raycast that goes from the player towards the direction its looking -
What is the issue? Include screenshots / videos if possible!
it seems the raycast is fired from another part when i told it to fire from the humanoidrootpart -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i’ve tried watching videos but i didnt find much…
local rayresults = {}
local origin = plr.Character:FindFirstChild("HumanoidRootPart").Position
local direction = (plr.Character:FindFirstChild("HumanoidRootPart").RayAttachment.WorldPosition - origin).Unit * 100
while task.wait(0.1) do
rayresults = workspace:Raycast(origin, direction)
print(rayresults,"RAYCASTED",origin,":: ::",direction)
if rayresults then
rayresults.Instance.Transparency = 0.5
end
end
this is what it prints out
but if i go to this specific place
attachment position: