How to move the player without shake on collide

I don’t want the character to cross objects or “shake” madly by spinning, flying etc, making the camera as crazy as he is, he will go up and down mountains with that speed, I want to do exactly like this game Friday the 13th: The Game.

local uis = game:GetService('UserInputService')
local db = false
local event = script:WaitForChild("RemoteEvent")
local pressed = false
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.ChildAdded:Wait()
local root = char:FindFirstChild("HumanoidRootPart")
local hum = char:FindFirstChild('Humanoid')
local cooldown = 10
local nowCol = 0
local ts = game:GetService("TweenService")
local tween = ts:Create(script.Parent.Fill, TweenInfo.new(cooldown), {ImageTransparency = .3})

uis.InputBegan:Connect(function(key, inputing)
	if key.KeyCode == Enum.KeyCode.Three then
		if hum:GetAttribute('Occupied') == true or hum:GetAttribute('Stunned') == true then return end
		if db == false and nowCol <= 0 then
			event:FireServer(false)
			db = true
			pressed = true
			BV=Instance.new('BodyVelocity', root)
			BV.MaxForce=Vector3.new(math.huge,0,math.huge)
			script.Parent.Fill.ImageTransparency  = 1
			script.Parent.Parent.Parent.Parent.Background.Ab3.Visible = false
			task.spawn(function()
				wait(5)
				if pressed then
					pressed = false
					nowCol = cooldown
					BV:Destroy()
					event:FireServer(true)
				end
				end)
			task.spawn(function()
				while pressed do
					wait(.1)
					BV.Velocity=root.CFrame.lookVector*100
				end
			end)
		end
	end
end)

uis.InputEnded:Connect(function(key, inputing)
	if key.KeyCode == Enum.KeyCode.Three then
		if pressed == true then
			pressed = false
			nowCol = cooldown
			BV:Destroy()
			event:FireServer(true)
		end
	end
end)

task.spawn(function()
	while wait(1) do
		if nowCol > 0 then
			nowCol = nowCol-1
			tween:Play()
			tween.Completed:Connect(function(playbackState)
				if playbackState == Enum.PlaybackState.Completed then
					script.Parent.Parent.Parent.Parent.Background.Ab3.Visible = true
					db = false
				end
			end)
		end
	end
end)
1 Like

You can use TweenService insted of BodyVelocity and tween the player to the position and the angle you want, BodyVelocity is not a good choise for your case, it will just increase the player speed and he will fall, spin or fly whenever hit any object

1 Like

Error: So the player ignores the objects and Position Y not is good

local uis = game:GetService("UserInputService")
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local root = char:WaitForChild("HumanoidRootPart")

local ts = game:GetService("TweenService")

local Tweeninfo = TweenInfo.new(
	10, 
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false,
	0
)
local ExtendDistance = 900
local TargetPos = root.CFrame + (root.CFrame.lookVector * ExtendDistance)
local tween = ts:Create(root,Tweeninfo,{CFrame = TargetPos})

uis.InputBegan:Connect(function(key, inputing)
	if key.KeyCode == Enum.KeyCode.Three then
		tween:Play()
	end
end)

uis.InputEnded:Connect(function(key, inputing)
	if key.KeyCode == Enum.KeyCode.Three then
		tween:Cancel() -- or pause
	end
end)
1 Like

That will not work great if the position of the player is variable I thought that the script will move the player to specific position, however moving the player when the position is variable is not impossible, but it is a little complicated you have to use raycasting to detect the objects and terrain on the player way to the next position and move him on top of them so hi doesn’t hit them, the is another solution that might work. Did you try to use BodyGyro with BodyVelocity

I thought about using bodygyro, it helps a little, but it doesn’t make it perfect, it’s not to dodge objects automatically, the player who controls the movement, if he hits something, he just has to move to get out of the wall