Is this normal? the helper thing doesn’t appear
WHOOOPS nvm
Is this normal? the helper thing doesn’t appear
WHOOOPS nvm
you can type check like this:
local animation : Animation = Instance.new(“Animation”)
that should make it correctly autofill
unless you fixed it bc that code should autofill by default
NONO i used the wrong variable.
It should’ve been playAnim
If it still doesn’t work there is something wrong with you. I dont know.
LOL ok i guess im mentally insane if theres a problem with me
It doesn’t work???
Luau is truely not buggy.
thiry char
Try this. Just destroying the Animation
-- Put "Slide Ability" in StarterPlayer and StarterCharacterScripts
-- Enjoy This Ability
local UIS = game:GetService("UserInputService")
local char = script.Parent
local humanoid = char:FindFirstChildOfClass("Humanoid")
local keybind = Enum.KeyCode.E
local canslide = true
local debounce = 3
UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if not canslide then return end
if input.KeyCode == keybind and canslide then
local animator = humanoid:FindFirstChildOfClass("Animator")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://9157679954"
canslide = false
local playAnim = animator:LoadAnimation(animation)
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()
playAnim:Destroy()
slide:Destroy()
wait(debounce)
canslide = true
end
end)
Doesn’t work. Same issue
thrychar
Something isn’t letting it get destroyed.
Cuz i did a repeat playanim:Destroy()
wait()
until playAnim:Destroy()
and slide STILL isn’t deleted (im sliding forever)
Try this but dont forget to put into starterplayerscript. You can also make this script in startercharacterscript but i chose the starterplayerscript.
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.CharacterAdded:Wait()
local animator = Character:WaitForChild("Humanoid").Animator
--Animation
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://9157679954"
local CanSlide = false
local waittime = 3
UserInputService.InputBegan:Connect(function(input,gameprocess)
if gameprocess then return end
if input.KeyCode == Enum.KeyCode.E and CanSlide == false then
CanSlide = true
local playAnim = animator:LoadAnimation(animation)
playAnim:Play()
local slide = Instance.new("BodyVelocity")
slide.MaxForce = Vector3.new(1,0,1) * 30000
slide.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 100
slide.Parent = Character.HumanoidRootPart
for count = 1, 8 do
wait(0.1)
slide.Velocity*= 0.7
end
slide:Destroy()
playAnim:Stop()
task.wait(waittime)
CanSlide = false
end
end)
Doesn’t work
thiry charact thing
Word of advice: Stop just saying “it doesnt work”, say WHY it doesn’t. How are we supposed to help if we don’t know what is wrong? We can’t test because we don’t know your game’s structure.
And answer me this: This script looks like taken from somewhere. The first comment states “Put “Slide Ability” in StarterPlayer and StarterCharacterScripts”. May I ask which script is it? Is it the same?
--- Services ---
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
--- Variables ---
local character = script.Parent
local Humanoid = character:FindFirstChildOfClass("Humanoid")
local keybind = Enum.KeyCode.E
local debounce = false
local Animator = Humanoid:FindFirstChildOfClass("Animator")
local slideAnimation = Instance.new("Animation")
slideAnimation.AnimationId = "rbxassetid://9157679954"
--- Private Functions ---
local function getSlide()
local track = Animator:LoadAnimation(slideAnimation)
return track
end
local function slide()
local track = getSlide()
track.Priority = Enum.AnimationPriority.Action4
track:Play()
local slideVelocity = Instance.new("BodyVelocity")
slideVelocity.MaxForce = Vector3.new(1,0,1) * 30000
slideVelocity.Velocity = character.HumanoidRootPart.CFrame.lookVector * 100
slideVelocity.Parent = character:WaitForChild("HumanoidRootPart")
local slideTween = TweenService:Create(
slideVelocity,
TweenInfo.new(0.8, Enum.EasingStyle.Exponential, Enum.EasingDirection.In, 0, false),
{Velocity = 5} -- target velocity
)
slideTween:Play()
end
--- Connections ---
UserInputService.InputBegan:Connect(function(inputObj, processed)
if processed or debounce then return end
if inputObj.KeyCode == keybind then
debounce = true
slide()
task.delay(0.8, function()
debounce = false
end)
end
end)
Now if it doesn’t work (assuming you did actually want to try) please reply with why it doesn’t, or if you spot any obvious mistakes please fix it.
why it doesn’t
thiry charact thing
Instead of relying on the Client for the “sliding” functionality, you can make this a client-server connection instead. You can rely on the client for detecting when the player presses the key to “slide” and the client will also play the animation, while the server will handle the actual sliding part and propel the player forward.
I think its bc u press alot of times thats why it doenst play the cooldown (i think)
Hi! I modified your code. I don’t know if it works because I’m on mobile but give it a try I guess?
So:
local UIS = game:GetService("UserInputService")
local char = script.Parent
local playAnim
local keybind = Enum.KeyCode.E
local canslide = true
local debounce = 3
UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if canslide == true then
if input.KeyCode == keybind and canslide then
local slideAnim = Instance.new("Animation")
slideAnim.AnimationId = "rbxassetid://9157679954"
playAnim = char.Humanoid:WaitForChild("Animator"):LoadAnimation(slideAnim)
playAnim.Priority = Enum.AnimationPriority.Action2
playAnim:Play()
canslide = false
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
wait(debounce)
playAnim:Stop()
slide:Destroy()
canslide = true
end
end
end)