Make model follow player smoothly and instantly

Hi,
I want to model follow player smoothly and instantly but its delayed and buggy, its on server script in StarterCharacterScripts using RunService Heartbeat and i want to make it smooth as it was on local script using Renderstepped. Here is script:

local LocalChar = script.Parent.Parent
local HumanoidRootPart = LocalChar:WaitForChild("HumanoidRootPart")
local RS = game:GetService("RunService")
local Aura = script.Parent.aura


RS.Heartbeat:Connect(function()
	Aura:MoveTo(HumanoidRootPart.Position + Vector3.new(0, -2.5, 0))
end)

Here is Screenshot what it does:

The block in the middle should be in the humanoidRootPart

1 Like

This should work:

local LocalChar = script.Parent.Parent
local HumanoidRootPart = LocalChar:WaitForChild("HumanoidRootPart")
local RS = game:GetService("RunService")
local Aura = script.Parent.aura


RS.Heartbeat:Connect(function()
	Aura.Position = HumanoidRootPart.Position + Vector3.new(0, -2.5, 0))
end

You could change RS.Heartbeat to RS.RenderStepped if you want to

2 Likes

I need that script to be in server script so all player will see it so renderStepped isnt possible and im moving model so .Position isnt possible too

2 Likes

You could maybe try parenting it to the player and welding it to the HumanoidRootPart

1 Like

Good try but it rotate and I want only to update the position

1 Like

that script dont work, output spits out “InputScript:5: attempt to index nil with ‘Character’” and “InputScript:16: attempt to call a thread value”, I tried to fix it but task.spawn is new to me

1 Like

made some changes and this worked for me in studio

local Aura = game.ReplicatedStorage.Aura --path to the aura
local RS = game:GetService("RunService")

local function AuraFollow(plr)
	local char = plr.Character or plr.CharacterAdded:wait()
	local clone = Aura:Clone()
	clone.Parent = char

	RS.RenderStepped:Connect(function()
		clone:MoveTo(char.HumanoidRootPart.Position + Vector3.new(0, -2.5, 0))
	end)
end


for i, player in pairs(game.Players:GetChildren()) do
	coroutine.wrap(AuraFollow)(player)
	
end

game.Players.PlayerAdded:Connect(function(plr)
	coroutine.wrap(AuraFollow)(plr)
end)
2 Likes

yeah it works, now i can continue

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.