-
What do you want to achieve? Keep it simple and clear! I am trying to position a pet to be behind the player.
-
What is the issue? Include screenshots / videos if possible! Whenever it hatches the pet’s cframe is not changed or set
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I looked at multiple solutions on developer hub but they didn’t work
My current script:
local PetM = _G.PetInfo
local Attachment0 = hum.RootRigAttachment
local Attachment1 = Instance.new('Attachment')
local Constraint = Instance.new('WeldConstraint')
local PosN = Instance.new('NumberValue')
PosN.Parent = pet.PrimaryPart
PosN.Value = petPos
PosN.Name = 'PetPos'
Constraint.Parent = pet.PrimaryPart
Attachment1.Parent = pet.PrimaryPart
Constraint.Part0 = hum
Constraint.Part1 = pet.PrimaryPart
print(hum.Position)
print(pet.PrimaryPart.CFrame)
pet.PrimaryPart.CFrame = hum.CFrame
--pet.PrimaryPart.Position += Vector3.new(0,5,0)
print(hum.CFrame)
print(pet.PrimaryPart.CFrame)
for i,part in pairs(pet:GetDescendants()) do
if part:IsA('Part') or part:IsA('MeshPart') then
part.CanCollide = false
part.Position += Vector3.new(0,3.5,0)
--part.Orientation += Vector3.new(0,-90,0)
--part.Position = part.Position - (part.CFrame.LookVector * Vector3.new(3,0,0))
--part.Position = part.Position + Vector3.new(0,0,(-3 + ((petPos - 1) * 3)))
else
continue
end
end
player:WaitForChild('PetForce').Value += PetM[pet.Name].Power
player:WaitForChild('Slots')[petPos].Value = true
player.leaderstats:WaitForChild('JumpPower').Value = (player:WaitForChild('PetForce').Value + player:WaitForChild('DefaultForce').Value)
The pet spawns way behind the player where it was made
but works when you reset
if you can tell me why this is happening that would be really helpful
Thanks.