How to make player freeze temporary

Making fighting game.
Trying to implement hitstun mechanic, but because of roblox’s client-server replications 0.15 becomes 1 second and teleports player far away.
any advices?

	hum:GetAttributeChangedSignal("Stunned"):Connect(function()
		if Statuses.Stunned == false then return end
		coroutine.wrap(function()
			char.PrimaryPart:SetNetworkOwner(nil)
			
			for i,v in pairs(char:GetChildren()) do
				if v:IsA("BasePart") then
					v.Anchored = true
				end
			end
			
			task.wait(0.15)
			
			Statuses.Stunned = false
			
			for i,v in pairs(char:GetChildren()) do
				if v:IsA("BasePart") then
					v.Anchored = false
				end
			end
			
			char.PrimaryPart:SetNetworkOwner(realPlr)
		end)()
	end)

You could have a local script detect it first for the client and freeze them locally, then have the server freeze them after the delay

Note, however, that exploiters may be able to bypass the local freezing

(Also, instead of doing a loop, just do char.HumanoidRootPart.Anchored = true, may reduce the delay)

1 Like

Thank you, ill try to do it, also i cant anchor only HumanoidRootPart since i need to completele freeze it.


Works much bettet

1 Like