this does indeed pin the character the same as doing Anchored but it also has the effect where the character rotation does not replicate to all clients
You can use a bodyposition at their current position to simply do this, or use a bodyvelocity with a velocity of like 0.01 to freeze them aswell
Try something like this:
local root
local actualPos = root.CFrame
game.RunService.RenderStepped:Connect(function(step)
root.CFrame = actualPos
end)
will try, i think i did this at first but im going to try again
I wonder if character orientation is only updated when the character moves
Didn’t realize, you could set the local gravity property to 0.
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
workspace.Gravity = 0
You can achieve that for a single local player too, without it affecting the other players server-wide.
this causes very visible character stuttering positions
this is worth a try for sure, but then again, setting gravity would have an effect on other things on that client, such as anything relying on physics. I don’t love Roblox physics anyway so I can maybe avoid using it …
EDIT: On second thought, this would not be good. If for example another character ied and their joints were broken, they would not fall. This is just one example that setgin gravity would be less than ideal for this. That said, I tried it and it works flawlessly! I wish setting the HRP to Massless had the same effect.
You can use bodyMovers. Such as: BodyVelocity, BodyPosition, etc
I set it all up with AlignPosition with all setting to max and its a bit jittery …
it turns out the AlignPosition which supersedes BodyPosition works well with these settings: https://i.imgur.com/Cnxcqia.png
Now, I don’t know exactly how to make a player freeze in mid air, however a way to disable a player’s controls would be using this code in a LocalScript (maybe in StarterGui?)
local PlayerModule = require(script.Parent:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
function disableControls()
Controls:Disable()
wait(5) -- or however long you need it to wait before the controls are enabled again
Controls:Enable()
end
--call the function when needed
no im not disabling player controls
Consider staying with anchor, but using remote events to replicate their rotation to other clients. You could send their current orientation to all connected players on Heartbeat interval. There would be (very) slight desync (client->server, the local client won’t see any desync at all), but you can see if that will work for you.
It has this result (of course, this is a local server so the latency is minimal):
Scripts used:
LocalScript
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OrientateCharServer = ReplicatedStorage:WaitForChild("OrientateCharacter")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")
ContextActionService:BindAction("Test", function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
HRP.Anchored = not HRP.Anchored
if HRP.Anchored then
task.spawn(function()
while HRP.Anchored do
HRP.CFrame = CFrame.new(HRP.Position, HRP.Position + Mouse.Hit.LookVector)
OrientateCharServer:FireServer(HRP.CFrame)
task.wait() -- Equivalent to Heartbeat:Wait()
end
end)
end
end
end, true, Enum.KeyCode.H)
Regular Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OrientChar = ReplicatedStorage.OrientateCharacter
OrientChar.OnServerEvent:Connect(function(player, cf)
player.Character.HumanoidRootPart.CFrame = cf
end)
And of course, there’s a remote event inside of ReplicatedStorage named OrientateCharacter
. It’s worth noting though, that this is relatively unsecure, so for that reason I recommend adding your own server-sided sanity checks (i.e. checking on the server if the ability is active and making sure the position of the new cframe is not far from the old one which would stop teleportation exploits on this remote, just know that what I gave is the bare minimum and is easily susceptible to exploits)
I did consider this but thats a lot of remote events, one on every hearbeat, YIKES! and then each machine receiving it wont be runnign at the same speed, so then it would jitter.
I am going to post what i did, it woks perfectly.
To solve this issue, I went with the newer AlignPosition and AlignOrientation instances.
i simple made an invisible part and put inside these:
For AlignPosition these were my settings:
Note that I did need to set ApplyAtCEnterOfMass and ReactionForceEnabled to true to stop it from jittering
For AlignOrientation i just set all the Force, Velocity, and Responsiveness at max:
nothing else was set for that.
From there its pretty simple. Just anchor that part in workspace and connect the AlignPosition and AlignOrientation to you character HumanoidRootPart attachment (you need to make one and put it in the HRP)
Then do all your CFraming on the CharacterLockPart. Now the character will stay in the exact same spot, even in mid-air but you can rotate the character locally and that rotation WILL replicate to all clients.
My loop looked like this:
connectionStep = RunService.RenderStepped:Connect(function()
local mousePos = mouse.Hit.Position
anchorPart.CFrame = CFrame.new(anchorPart.CFrame.Position, Vector3.new(mousePos.X, mousePos.Y, mousePos.Z))
end)
Heres how it looks:
Thanks to everyone who contributed. I marked my own reply as solution because its the most detailed and has an actual solution to the issue if anyone ever needs to look this up.
Impressive, looks very good. Well done!
Thanks for the script been looking for something like this for days
You can set PlatformStand to true.
this can work but animations will end up looking weird