Hello!
I’m trying to create a Body possession / Mind control style of script. I’ve done this fine with MousePosition. However, I really want to convert the controls for this to be replicated by WASD. Everything is working perfectly and as it should, with no bugs or issues except for one part of the script. When prompting movement for the other player, it will move the target player in that same way your character would walk. However, because I have it on a RenderStepped basis, the move direction is constantly being re-adjusted, and this causes the below movement issue where it’s ‘jagged’
I’ve tried the below,
humanoid:Move(value*100, false)
increasing walkspeed and took a look at Roblox’s core movement to understand how they go about regular movement but can’t seem to figure out what to do. I’ve tried setting Plr.Character to their body instead. However, this yields the same result of that slow movement and upon switching back, UI is reset.
My next thought was going to be a system where they move continuously in the set direction until input is ended but I worry this may not be the cleanest way to do this. Has anybody got any ideas?
For reference, my code is below:
Thank you in advance!
Aim/Summary - How can I make it smoother like how roblox characters regularly walk
(Function works but because of RunService, it comes out jagged on movement)
--Local
game:GetService("RunService").RenderStepped:Connect(function()
if humanoid.MoveDirection.Magnitude > 0 then
remote:FireServer(
"Move",
humanoid.MoveDirection,
targetname
)
else
remote:FireServer(
"Move",
Vector3.zero,
targetname
)
end
end)
-- Send jump
UserInputService.JumpRequest:Connect(function()
remote:FireServer("Jump",nil,targetname)
end)
end)
--Server
remote.OnServerEvent:Connect(function(player, action, value,targetname)
local target = game.Players:FindFirstChild(targetname)
if not target or not target.Character then
return
end
local humanoid = target.Character:FindFirstChildOfClass("Humanoid")
if not humanoid then
return
end
if action == "Move" then
humanoid:Move(value, false)
elseif action == "Jump" then
humanoid.Jump = true
end
end)