local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Humanoid = Player:FindFirstChild("Humanoid")
local Hroot = Humanoid.HumanoidRootPart
local Pet = script.Pets.Test_Pet
local function SetPetCFrame()
Pet.CFrame = Hroot.CFrame * CFrame.new(2, 2, -3)
end -- Hroot is player's HumanoidRootPart
game:GetService("RunService"):BindToRenderStep("SetPet", Enum.RenderPriority.Last, SetPetCFrame)
I don’t think HumanoidRootPart is a valid member of Humanoid.
HumanoidRootPart belongs to the character, not the humanoid.
So try this:
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local Hroot = char.HumanoidRootPart
local Pet = script.Pets.Test_Pet
local function SetPetCFrame()
Pet.CFrame = Hroot.CFrame * CFrame.new(2, 2, -3)
end -- Hroot is player's HumanoidRootPart
game:GetService("RunService"):BindToRenderStep("SetPet", Enum.RenderPriority.Last, SetPetCFrame)
Here is an api reference for you on using the character!
Soo your solution might of worked but its my fault that I put the pets folder into the script, and its nill and I got a new problem for that, and here is the code: (Sorry for being a pain)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local Hroot = char.HumanoidRootPart
local Pet_S = game.ReplicatedStorage.Pets.Test_Pet:Clone()
Pet_S.Parent = workspace or game.Workspace
local function SetPetCFrame()
Pet_S.CFrame = Hroot.CFrame * CFrame.new(2, 2, -3)
end -- Hroot is player's HumanoidRootPart
game:GetService("RunService"):BindToRenderStep("SetPet", Enum.RenderPriority.Last, SetPetCFrame)