Hello! So I’ve been tinkering with a script that is meant to position the ghost around and for some reason it just won’t work anymore. It all happened when I went to redo the stream effect but I triple checked and that isn’t what is causing it. I believe what is causing it might be the .Unit segment of it. Here is a video of what it looked like before and was working fine:
Here is what it looks like now:
Here is a glimpse at the code that does the moving stuff:
if ButtonDown == true and values.capturable.Value == true then
if hit:FindFirstChild("CapturePosition") then
hit.AssemblyLinearVelocity = Vector3.new(0,0,0)
hit.AssemblyAngularVelocity = Vector3.new(0,0,0)
hit.CapturePosition.Position = tool.Handle.Position + newMousePos.Unit * Distance
print(hit.CapturePosition.Position)
else
Distance = 20
local CaptureAttachment = Instance.new("Attachment")
CaptureAttachment.Name = "CaptureAttachment"
CaptureAttachment.Parent = hit
local CapturePosition = Instance.new("AlignPosition")
CapturePosition.Name = "CapturePosition"
CapturePosition.Position = hit.Position
CapturePosition.MaxForce = Vector3.new(1,1,1).Magnitude
CapturePosition.Mode = Enum.PositionAlignmentMode.OneAttachment
CapturePosition.RigidityEnabled = true
CapturePosition.ApplyAtCenterOfMass = true
CapturePosition.Parent = hit
CapturePosition.Attachment0 = CaptureAttachment
CapturePosition.ApplyAtCenterOfMass = true
local captureStream = script.Parent.Handle.OpenBarrel.captureParticle:Clone()
captureStream.Parent = hit.Parent:FindFirstChild("HumanoidRootPart")
captureStream.Enabled = true
hit.Anchored = true
hit.Parent.Humanoid.AI.Misc:FindFirstChild("Capturable").Value = true
local Anchor = script.Anchor:Clone()
Anchor.Parent = hit
Anchor.Disabled = false
Player.PlayerGui.SlamArrows.Adornee = hit
sfx.LockOn:Play()
script.Parent.Handle.Tip.Part.captureffect.Enabled = true
wait(0.5)
script.Parent.Handle.Tip.Part.captureffect.Enabled = false
end
end
Any help on trying to figure out what is happening and that will point me in the right direction will be greatly appreciated! Thank you all in advance.