Hello! I was trying to make my player slide under some objects when I saw my player’s hitbox is too big. Any way to fix it? (Sorry if it’s the wrong category)
LocalScript:
local UIS = game:GetService("UserInputService")
local char = script.Parent
local slideAnim = Instance.new("Animation")
slideAnim.AnimationId = "rbxassetid://8676154417"
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local keybind = Enum.KeyCode.LeftControl
local canslide = true
local jumped = false
UIS.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.Space then
jumped = true
end
end)
UIS.InputEnded:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.Space then
wait(1.5)
jumped = false
end
end)
UIS.InputBegan:Connect(function(input, gameprocessed)
if gameprocessed then return end
if not canslide then return end
if jumped then return end
if input.KeyCode == keybind then
if jumped then return end
canslide = false
local playAnim = char.Humanoid:LoadAnimation(slideAnim)
playAnim:Play()
local slide = Instance.new("BodyVelocity")
slide.MaxForce = Vector3.new(1,0,1) * 30000
slide.Velocity = char.HumanoidRootPart.CFrame.lookVector * 100
slide.Parent = char.HumanoidRootPart
for count = 1, 8 do
wait(0.1)
slide.Velocity *=0.7
end
playAnim:Stop()
slide:Destroy()
canslide = true
end
end)