I have a situation where the player can hold a key down, and their character is to be pinned in place, even in mid-air. While pinned in place, their character is rotated to face the mouse.hit position.
This works fine right now on the client that does this, but because I am anchoring the HumanoidRootPart to pint hem in place, their character rotation is not being replicated to all clients.
I tried using physics things like AlignPosition but it felt very wobbly.
Does anyone know a good way to achieve what i need?
I mean, you could try welding the character to an anchored part some random place on the map (hence freezing it in place), and enabling Humanoid.PlatformStand, and making walkspeed and jumpheight 0.
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
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.
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