why does my pet [part] not moving along the player and how can i fix it ?
Btw, here is the Scrript:
local newPet = script.Parent
newPet.CanCollide = false
newPet.CanTouch = false
local petPos = Instance.new("BodyPosition",newPet)
local petGypro = Instance.new("BodyGyro",newPet)
petGypro.MaxTorque = Vector3.new(900000,900000,900000)
local followPos = Vector3.new(2,2,0)
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
while wait() do
local plr = game.Workspace:WaitForChild(player.Name)
local playerPos = plr.HumanoidRootPart.Position
local stopAt = ((playerPos - newPet.Position).magnitude - 1) * 1000
petPos.P = stopAt
petPos.Position = playerPos + followPos
petGypro.CFrame = plr.HumanoidRootPart.CFrame
end
end)
end)
for now, I did not clone the part, just for testing, I did this!
Waiting for your Support and you can ask me if i need to give anything else and there are no errors btw!
is it completely not moving at all?
MrREDDeveloper:
magnitude
You might want to make it caps(i think idk)
yes, it’s not completely moving along the players!
WingItMan
(WingItMan)
September 22, 2021, 10:09am
#6
Have you increased the Force of your BodyPosition?
Also, the CharacterAdded event gives a reference to the Player’s Character in the parameters, like you PlayerAdded event. So you don’t need the plr reference in the loop
no i did not increased the force of the body pos and ye i changed that local plr
Just making sure, it is a normal script right?
yes its a normal script which is inside the part who is in the workspace
Is the Anchored property of the pet set to false?
1 Like
ye as u can see in the script, it is said to be false
thats cancollide i meant anchored i dont see anchored in the script
1 Like
lmfao sorry, instead of setting anchored to false i accidently set the can touch to false. Now everything is working properly! thx
also btw there is another problem like when i stop, the part slowly moves down even insiide the ground! how can i fix that ?
You can have a anti gravity script
-- heres one for u (put inside pet)
local part = script.Parent
local downForce = -part:GetMass()*workspace.Gravity
local force = -downForce
local bodyForce = Instance.new("BodyForce")
bodyForce.Force = Vector3.new(0,force,0)
bodyForce.Parent = part
ok that got fixed thx! but when i stop the part moving and stopping at through my face. What do you think i should put it in stop at ?
uhh I dont get what you mean do u mean it is right at ur face or what
going inside my face + going right when i stop moving here is a screenshot:
tbh i dont know how to fix this now lol you might have to start a new topic on this
lol its problem as my part is much bigger