-- VSB Lua script for basic character movement
-- Player and character setup
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
-- Movement settings
local walkSpeed = 16 -- Adjust as needed
local lerpFactor = 0.1 -- Adjust as needed
-- Create the walking animation function
local function walkAnimation()
local rootPart = character:WaitForChild("HumanoidRootPart")
local originalPosition = rootPart.Position
while wait(0.1) do
local moveVector = Vector3.new(0, 0, 0)
if humanoid.MoveDirection.Magnitude > 0 then
moveVector = humanoid.MoveDirection
moveVector = Vector3.new(moveVector.X, 0, moveVector.Z) -- Ignore vertical movement
-- Normalize the moveVector so that the character moves at a consistent speed
moveVector = moveVector.Unit * walkSpeed
-- Interpolate the position for smooth movement
rootPart.Position = originalPosition:Lerp(originalPosition + moveVector, lerpFactor)
end
end
end
-- Connect the walking animation function to the character's Move event
humanoid.Move:Connect(walkAnimation)