I have an unanchored part on a baseplate.
I have 2 scripts. A client script that sends a remote to the server when I hit E, and a server script that anchors the character root when it receives the remote event then shortly unanchors the root part.
Server script
local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local runService = game:GetService("RunService")
local ANCHOR_DURATION = 5.2
local TRACE_WINDOW = 8
local TRACE_THRESHOLD = 0.5
local remote = Instance.new("RemoteEvent")
remote.Name = "AnchorTest"
remote.Parent = replicatedStorage
local busy = {}
remote.OnServerEvent:Connect(function(player)
if busy[player] then return end
local character = player.Character
local root = character and character:FindFirstChild("HumanoidRootPart")
local humanoid = character and character:FindFirstChildWhichIsA("Humanoid")
if not root then return end
busy[player] = true
-- chad reaches UseAbility through a task.spawn off the remote handler
task.spawn(function()
root.Anchored = true
task.delay(ANCHOR_DURATION, function()
busy[player] = nil
root.Anchored = false
end)
end)
end)
players.PlayerRemoving:Connect(function(player)
busy[player] = nil
end)
Client script
local userInputService = game:GetService("UserInputService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local remote = replicatedStorage:WaitForChild("AnchorTest")
userInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode ~= Enum.KeyCode.E then return end
remote:FireServer()
end)
When you jump off the unanchored part then hit e, you character anchors in mid air. On unanchored, the players character movements are then transposed on the server until they jump back on the unanchored part.
Video:
Replication place attached. Replication steps.
1.) Jump on the part.
2.) Jump off the part, hit e mid air.
test.rbxl (62.8 KB)
Disabling ImprovedPhysicsReplication prevents this issue.
Expected behavior
The client and servers view of the players character should remain synced after unanchoring.
This undesirable behavior was discovered in our game Yeet Battles after some debugging when certain abilities resulted in users characters going off to Narnia
.