#Sliding working mid air
1 messages · Page 1 of 1 (latest)
Guarda Untitled di justalexx e milioni di altri video di Roblox Studio su Medal. #robloxstudio
local char = script.Parent
local humanoid = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local slideAnim = Instance.new("Animation")
slideAnim.AnimationId = tostring(script:WaitForChild("SlideAnim").AnimationId)
local KEYBIND = Enum.KeyCode.LeftShift
local COOLDOWN = 2.4
local SLIDE_DURATION = 1.2
local START_SPEED = 50
local MAX_SPEED = 60
local ACCELERATION = 8
local MAX_FORCE = 20000
local canSlide = true
UIS.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode ~= KEYBIND then return end
if not canSlide then return end
if humanoid.MoveDirection.Magnitude <= 0.1 then return end
canSlide = false
-- Disabilita la rotazione automatica del corpo durante lo slide
humanoid.AutoRotate = false
local animTrack = humanoid:LoadAnimation(slideAnim)
animTrack:Play()
animTrack:AdjustSpeed(0.6)
if script:FindFirstChild("Slide") then
script.Slide:Play()
end
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
local dir = humanoid.MoveDirection
if dir.Magnitude > 0 then
dir = Vector3.new(dir.X, 0, dir.Z).Unit
else
dir = hrp.CFrame.LookVector
dir = Vector3.new(dir.X, 0, dir.Z).Unit
end
local attachment = Instance.new("Attachment")
attachment.Parent = hrp
local velocity = Instance.new("LinearVelocity")
velocity.Attachment0 = attachment
velocity.RelativeTo = Enum.ActuatorRelativeTo.World
velocity.MaxForce = MAX_FORCE
velocity.VectorVelocity = dir * START_SPEED
velocity.Parent = hrp
local speed = START_SPEED
local startTime = time()
while time() - startTime < SLIDE_DURATION do
speed = math.min(speed + ACCELERATION * 0.1, MAX_SPEED)
velocity.VectorVelocity = dir * speed
task.wait(0.1)
end
velocity:Destroy()
attachment:Destroy()
animTrack:Stop()
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
-- Riabilita la rotazione automatica del corpo dopo lo slide
humanoid.AutoRotate = true
task.wait(COOLDOWN)
canSlide = true
end)```
1 sec
** You are now Level 2! **
@delicate jacinth
i fixed the problem
if you have fixed it yourself already just let me know
i went to eat sorry
local MAX_FORCE = 999999999
local velocity = Instance.new("LinearVelocity")
velocity.Attachment0 = attachment
velocity.RelativeTo = Enum.ActuatorRelativeTo.World
velocity.MaxForce = MAX_FORCE
velocity.VectorVelocity = dir * START_SPEED
velocity.Parent = hrp
velocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis
velocity.MaxAxesForce = Vector3.new(999999, 0, 999999)
add these 2 lines in your velocity define logic
and change the maxforce number that you defined at the top
to what i changed it to
let me know if it works
just ping me
@delicate jacinth
now this happens
Guarda Untitled di justalexx e milioni di altri video di Roblox Studio su Medal. #robloxstudio
@jagged jasper
are you still sliding mid air?
nope
ok so if thats fixed what is the new problem
is it the character turning
when sliding
yh
lemme look into it
as when i was testing your code in studio
i dont have the animation so i just removed that part of the code
so on my test it looked normal
and now a bug that i fixed showed up again
basically when i slide into something my character flings
flings like out of the map or just like falls over and not standing?
with the animation it might be anim priority issue but im not sure
as when im testing with no animation
the character is not turning at all in anyway
or the way your camera module is making it work
Guarda Untitled di justalexx e milioni di altri video di Roblox Studio su Medal. #robloxstudio
ive had this problem before
let me find the fix rq
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding, false)
priority is set to action
you need to set the humanoid state while the dash is on
so fallingover etc is false
then when you slide into something it shouldnt happen
** You are now Level 3! **
where do i put ts
for now just put it where you put jumping false in the code you sent
and tell me if it fixed it
like under or do i have to replace it
under
it kind of fixed it
Guarda Untitled di justalexx e milioni di altri video di Roblox Studio su Medal. #robloxstudio
dont mind the voice
but yeah ig its fixed
it might look odd because its a slide
i used this for a dash
and it was fine
but i was using body velo
and the animation turning is either your camera module or anim priority as when i test with no animation the character is not turning at all
the priority is set to action
does your camera module have unique shift lock or anything like that
i didnt work on that my friend did sadly
i got 3 camera scripts
Camera, Camerabobbing and cameragyro
also autorotate stops the character from looking where the camera is but any external force will move it
like sliding on the floor
could be moving your character slightly
which could be causing the turning
so i remove autorotate?
do you want the character to turn at all in the slide?
my friend didnt want to but i can tell him it was to fix a bug
yh it was that
ty
np