I made this script so I can have a similar effect to this:
This is what’s happening right now:
But The velocity isn’t working at all. Also, is there any way to design this script better?
When I go into the playtest to test it out. It only plays the animation and prints all the prints, there’s no velocity at all.
local module = {}
function module.Roll (plr,char)
-- Services
local RS = game:GetService("ReplicatedStorage")
local SoundService = game:GetService("SoundService")
-- Folders
local RSStorage = RS.Storage
local RSAnimations = RSStorage.Animations
local SFXFolder = SoundService.SFX
local RollSound = SFXFolder.Movement.Roll
-- Values
local Hum = char:WaitForChild("Humanoid")
local HumRP = char:WaitForChild("HumanoidRootPart")
local RollAnimation = Hum:LoadAnimation(RSAnimations.Movement.Roll)
local RollDebounce = false
local DashingDebounce = false
local CanDoAnything = true
-- Modules
local SoundModule = require(RSStorage.Modules.Combat.SoundsModule)
print ("Roll module")
if RollDebounce == false and char:FindFirstChild("Disabled") == nil then
RollDebounce = true
CanDoAnything = false
delay(0.3,function()
CanDoAnything = true
end)
delay(2.5,function()
RollDebounce = false
end)
Hum.JumpHeight = 0
RollAnimation:Play()
DashingDebounce = true
-- Play with sounds module
SoundModule.PlaySound(RollSound,char.Torso)
delay(0.25,function()
DashingDebounce = false
Hum.JumpHeight = 7.2
end)
repeat
HumRP.Velocity = HumRP.CFrame.lookVector * 130 / 1.5
print ("Dash Velocity")
wait(0.1)
until DashingDebounce == false
end
if RollDebounce == true then
Hum.JumpHeight = 0
wait (0.5)
Hum.JumpHeight = 7.2
end
end
return module