Body velocity restricts character movement

I want to make my character levitate, while also being able to move by pressing W,A,S,D. unfortunately linear velocity and body velocity seem to restrict player movement completely

I also tried the velocity property, but thats deprecated + i’d need to change it every frame

2 Likes

Here’s a script from my game that takes over controls during levitation.

local isIntroSequece = script.Parent:FindFirstChild("isIntroSequence")
local player : Player = game.Players.LocalPlayer
local playerScripts = require(player.PlayerScripts.PlayerModule)
local controls =   playerScripts:GetControls()
glider = game["Run Service"].Stepped:Connect(function()
	
	if isIntroSequece ~= nil and isIntroSequece.Value ~= false then



		local direction = controls:GetMoveVector()
		
		
		local humanoidRootPart = player.Character.HumanoidRootPart
		humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.CFrame.Position + ((direction * 2) * Vector3.new(-1, 1, -1)) ) * humanoidRootPart.CFrame.Rotation
	else
		glider:Disconnect()
	end
end)

You will need to modify it for camera relative movement (I didn’t require for my use case.)

put this in game.StarterPlayer.StarterCharacterScripts

make a script that adds boolvalue to player “isIntroSequence” (rename it to whatever you want) and set it true when levitating.

2 Likes

any way to make it the same exact speed of the walkspeed without insane amounts of tweaking

1 Like

change it to direction * 0.5 which will make it 2x slower and try lowering number until you find something you are comfortable with

so basically you’re saying just tweak until im comfortable with it

yes there isn’t an exact way to convert walkspeed to this other than try and find a “magic value” and calculate speed from humanoid walkspeed relative from that

1 Like

ok. what ill do is find a speed im comfortable with, and then divide that by 18 (the base walkspeed in my game) and multiply that by how much the player currently has. thanks for replying btw

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.