Delayed Character CFrame

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to make the player freeze in place and have a frozen block spawn in the player
game.ReplicatedStorage.FreezeEvent.OnServerEvent:Connect(function(hit)
	local freeze = Instance.new("Part")
	freeze.Size = workspace.FreezeExample.Size
	freeze.Name = "Freeze"
	freeze.Anchored = true
	freeze.Material = "Ice"
	freeze.Color = Color3.new(0.2, 0.345098, 0.509804)
	freeze.Transparency = 0.4
	freeze.CanCollide = true
	freeze.CFrame = hit.Character.HumanoidRootPart.CFrame
	freeze.Parent = workspace
	for index, Instance in pairs(hit.Character:GetChildren()) do
		if Instance:IsA("BasePart") then
			Instance.Anchored = true
		end
	end
	task.wait(3)
	print(freeze.CFrame)
	print(hit.Character.HumanoidRootPart.CFrame)
	for index, Instance in pairs(hit.Character:GetChildren()) do
		if Instance:IsA("BasePart") then
			Instance.Anchored = false
		end
	end
	freeze:Destroy()
end)
  1. What is the issue? Include screenshots / videos if possible!
    Whenever the block is spawned it is slightly delayed from the character

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried checking the CFrame but it shows both as the same despite that clearly not being the case

2 Likes

The “freeze” part is being positioned before all of the Character’s parts have been Anchored, which means that there might be a small period of time where the Character can continue moving away from the placement of the “freeze” part, resulting in that offset (especially if the Character was moving fast from jumping or falling at that moment).


Try setting freeze.CFrame and freeze.Parent after the loop to see if that resolves it (since the HumanoidRootPart would be frozen in place before the “freeze” part is repositioned to the same spot).

2 Likes

Unfortunately this does not work and the two prints I have in the script

	print(freeze.CFrame)
	print(hit.Character.HumanoidRootPart.CFrame)

are different from what is shown in game its almost like it pulls all the variables a half a second before adding them in. Even with a task.wait included between the defining of CFrame and anchoring it still is delayed to slightly before

All you need to do is anchor the character limbs and weld the ice block to the HumanoidRootPart. You don’t need to anchor the ice block.

2 Likes

Thank you I totally forgot I could do that and spent a day dwelling over this