This is my script, but it dont spawn in front of the player, how i can fix this?
plr.Character.HumanoidRootPart.CFrame.LookVector * 40
Youre setting the goal to be 40 studs on the negative Z axis, so the part will only travel one direction.
Instead, get the HumanoidRootParts Lookvector, and multiply it by the range.
local Range = 40 -- 40 studs
-- This might work, might not. Not sure if it does. Give it a try.
local EndPos = HumanoidRootPart.Position + (HumanoidRootPart.CFrame.LookVector * Range)
-- If youre going to create a tween and play it right after, dont bother creating a variable for it.
TweenService:Create(Part, TweenInfo.new(1, Enum.EasingStyle.Linear), {["Position"] = EndPos}):Play()
1 Like