Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Smooth server movement?

I would like to resume working on my third person player script, and to do that, I'd like to fix the only real bug that currently exists, which is the player's movement appears laggey out of studio's run mode. CFrame, Velocity and Humanoid:MoveTo() don't work, I don't think using a body force would work, does anyone have any suggestions

My movement coroutine:

plrCnt = coroutine.wrap(function()
game:GetService("RunService").RenderStepped:connect(function()

local direction = cam.CoordinateFrame.lookVector

plr.Core.Velocity = Vector3.new(0,plr.Core.Velocity.y,0)

if ks[Enum.KeyCode.W] and ks[Enum.KeyCode.A] then
		
elseif ks[Enum.KeyCode.W] and ks[Enum.KeyCode.D] then

elseif ks[Enum.KeyCode.S] and ks[Enum.KeyCode.A] then
		
elseif ks[Enum.KeyCode.S] and ks[Enum.KeyCode.D] then
		
elseif ks[Enum.KeyCode.W] then
	local test = Vector3.new(plr.Core.Position.x + direction.x*speed,plr.Core.Position.y,plr.Core.Position.z + direction.z*speed)	
	plr:MoveTo(test)	
	plr.Core.CFrame = CFrame.new(plr.Core.Position, plr.Core.Position+Vector3.new(direction.X,0,direction.Z))*CFrame.new(0,0.1,0)
elseif ks[Enum.KeyCode.S] then
	local test = Vector3.new(plr.Core.Position.x + -direction.x*speed,plr.Core.Position.y,plr.Core.Position.z + -direction.z*speed)	
	plr:MoveTo(test)	
	plr.Core.CFrame = CFrame.new(plr.Core.Position, plr.Core.Position+Vector3.new(direction.X,0,direction.Z))*CFrame.new(0,0.1,0)	
elseif ks[Enum.KeyCode.A] then
	plr.Core.CFrame = CFrame.new(plr.Core.Position, plr.Core.Position+Vector3.new(direction.X,0,direction.Z))*CFrame.new(0,0.1,0)
	--plr.Core.Velocity = Vector3.new(direction.z*-speed,plr.Core.Velocity.y,direction.x*-speed)	
elseif ks[Enum.KeyCode.D] then
	plr.Core.CFrame = CFrame.new(plr.Core.Position, plr.Core.Position+Vector3.new(direction.X,0,direction.Z))*CFrame.new(0,0.1,0)
	--plr.Core.Velocity = Vector3.new(direction.z*speed,plr.Core.Velocity.y,direction.x*speed)
	
end
end)
end)

My whole script:

http://pastebin.com/cSb87ymG

Thanks!

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.