What am I trying to do?
I’m trying to make a quest system where it makes an arrow and using raycasting and runservice I’m going to make an arrow that shows a player where to go.
Issue?
The problem is the goal(aka the part or the area I want the player to be near/around) is shown as nil. I’m using a module script to make a function that creates and moves the arrow. I’m using a local script to reference the arrow( with a waitforchild).
Solutions I’ve tried?
I’ve tried looking at a similiar topic and using waitforchild and findfirstchild.
Module script:
makearrow = function(goal, origin, name)
print(goal)
print(origin)
local direction = (goal - origin).Unit
local midpoint = origin + direction/2
local raycastresult = workspace:Raycast(origin, direction)
if raycastresult then
local arrow = Instance.new("Part", workspace)
arrow.Name = "Arrow"..name
arrow.CFrame = CFrame.new(midpoint,origin)
arrow.Size = Vector3.new(0.5,0.5,direction.Magnitude)
end
end,
Line that makes the arrow:
functionsmodule.makearrow(laddergoal.Position,hrp.Position)
Referencing goal:
local laddergoal = workspace:WaitForChild("ArrowGoals"):FindFirstChild("ArrowGoal1")
Getting the humanoidrootpart:
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:FindFirstChild("HumanoidRootPart")
Everything else in the module script and local script is pretty irrelevant