Please help me with this issue.
repeat wait(0.1) until (game.Players.LocalPlayer ~= nil) and (game.Players.LocalPlayer.Character ~= nil) Player = game.Players.LocalPlayer Char = Player.Character Cam = game.Workspace.CurrentCamera Cam.CameraType = "Scriptable" Cam.CameraSubject = Char.Humanoid P = Instance.new("Part",Char) P.Name = "CamTrace" P.Transparency = 1 P.CanCollide = false Vel = Instance.new("BodyPosition",P) Vel.Name = "Vel" Vel.maxForce = Vector3.new(10000,10000,10000) while true do wait(0.01) Vel.position = Char.Torso.Position Cam.CoordinateFrame = P.CFrame*CFrame.new(0,30,0)*CFrame.Angles(math.rad(-90),0,0) end
Just because you inserted a part into your character doesn't mean that the part is officially welded to the character. The only object that should be moving is the Part. You can weld the parts together to fix the issue, or you can put the BodyPosition in the character.
If you simply create a part, and place it into your character, it does not mean that that part is ATTATCHED to your character
There are two ways to solve your problem.
1) Weld the part to your character, then add the BodyPosition.
To do this, you'll need a Weld
object. Create weld, and set the Part0
and Part1
properties to the two bricks you want to weld together, which in your case is the part and the Torso.
local p = Instance.new('Part',char) --Create the part p.Name = 'CamTrace' p.CanCollide = false p.Transparency = false --Add BodyPosition to part here local w = Instance.new('Weld',p) --Create the weld w.Part0 = p --set 'Part0' to the part w.Part1 = char.Torso --set 'Part1' to the Torso
2) Add the BodyPosition to your character's Torso.
This method is preferable, as you will not be adding un needed parts to your Character model.
local bp = Instance.new('BodyPosition',char.Torso) --Define maxForce and position properties.