Essentially, I want a part to be created three studs away from the player's torso when another part is touched. I want it to be three studs away from the torso at all times and also be ahead of it - no other direction. I hope to achieve this by using lookVector, but another method will also be accepted if it gets the job done. Just in case you need some more imagery, it should resemble a fairy following you.
Here's my code:
local pad=script.Parent
local DistanceAwayFromPlayer=3
pad.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
print(hit.Parent.Torso.CFrame.lookVector)
part=Instance.new("Part",workspace)
part.Anchored=true
part.Size=Vector3.new(1,1,1)
fire=Instance.new("Fire")
fire.Size=Vector3.new(1,1,1)
--part.Transparency=1
fire.Parent=part
pad.Parent=game.ServerStorage
while wait() do
part.CFrame=hit.Parent.Torso.CFrame.lookVector + Vector3.new(0,0,DistanceAwayFromPlayer)
end
end
end)
This is the error I'm receiving:
22:11:18.492 - Workspace.Pad.Script:18: bad argument #3 to 'CFrame' (CFrame expected, got userdata)
The script creates the part and everything but puts it at the center of the map rather than having it three studs ahead of the torso. Any help on this matter would be greatly appreciated!

1 comment
Please do not deterred to answering this question by the large amount of words. I used a lot of words so that you guys could better understand my problem.