Question 1
I was testing around with parts and stuff , and tried the body positions and gyros , and I wanted to make it so that the part follows the player, but for some reason it doesn’t follow the back of the player in that one specific direction.
Code
local Disabled = false
local Player = game.Players:FindFirstChild(script.Parent.Parent.Name)
if Player then
while task.wait() do
if Player.Character.Health ~= 0 then
if not Disabled then
local Pos = script.Parent.Pos.Value
local BG = script.Parent.PrimaryPart.BodyGyro
local BP = script.Parent.PrimaryPart.BodyPosition
local d = Player.Character.HumanoidRootPart.Position.Y - script.Parent.PrimaryPart.Position.Y
BP.Position = (Player.Character.HumanoidRootPart.Position + Pos) - Vector3.new(0,Player.Character.HumanoidRootPart.Size.Y/2,0) + Vector3.new(0,script.Parent.PrimaryPart.Size.Y/2,0) + Vector3.new(0,game.ServerScriptService.Systems.Pets.globalPetFloat.Value,0)
if Player.Walking.Value == false then
BG.CFrame = CFrame.new(script.Parent.PrimaryPart.Position, Player.Character.HumanoidRootPart.Position - Vector3.new(0, d, 0))
else
BG.CFrame = Player.Character.HumanoidRootPart.CFrame
end
else
script.Parent:Destroy()
break
end
else
Disabled = false
end
end
end
Question 2
how would I make the part kind of have stick to the ground like the player and when the player goes to a higher place jump right over there together with this moving script.
is already detecting player walk, yes.
Also I don’t know what kind of welding you are talking about , but if I put a weld for the player’s character and the part it wouldn’t work and the player accompanied with this script would fly to the sky attached to the part
local Game = game
local Workspace = workspace
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Part = Instance.new("Part")
Part.Parent = Workspace
local function OnRenderStep()
Part.CFrame = Character:GetPivot() * CFrame.new(0, 0, 5)
end
RunService.RenderStepped:Connect(OnRenderStep)