This has already been solved, button shows up now
ContextActionsService issue when trying to play script? SOLVED With the help of brokenVectors
3 answers
There are a lot of issues with your code.
Almost 70% of all your lines are just creating trails and editing their properties. You can make an array of all the player's limbs, and parent the trails to them.
You're connecting the function inside of the function, which makes absolutely no sense and it doesn't work.
You also have an event inside of the function that's connected, which also makes no sense??? This will cause memory leaks and it's just useless.
:remove() is deprecated. Use :Destroy() instead.
You're defining the player twice.
You're redefining the character???
CharacterAdded isn't written correctly, thanks @Dovydas118 for noticing lol
You're using the second parameter of Instance.new, which parents the object even before you change any properties, which then fires all the Changed events(decreases performance a ton)
Note that I didn't fix every single issue, I'll leave that up to u. Please tell me if anything doesn't work.
local player = game.Players.LocalPlayer
local Char = player.Character or player.CharacterAdded:Wait()
local UIS = game:GetService("UserInputService")
local humanoid = player.Character:WaitForChild("Humanoid")
local context = game:GetService("ContextActionService")
local debounce = false
local cooldown = 1 -- Time to wait between 2 dash
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=5311749838"--Insert ID here
local function Onbuttonpress()
if debounce == false then
debounce = true
local playAnim = humanoid:LoadAnimation(anim)
playAnim:Play()
local Character = game.Workspace:WaitForChild(player.Name)
Char.HumanoidRootPart.Velocity = Char.HumanoidRootPart.CFrame.lookVector*500
local Trail1 = Instance.new("Trail",Character)
Trail1.Attachment0 = Character.RightFoot:FindFirstChildOfClass("Attachment")
Trail1.Attachment1 = Character.RightLowerLeg:FindFirstChildOfClass("Attachment")
Trail1.Lifetime = 0.2
Trail1.MaxLength = 1
Trail1.WidthScale = NumberSequence.new(0.8)
Trail1.FaceCamera = false
local Trail2 = Instance.new("Trail",Character)
Trail2.Attachment0 = Character.LeftFoot:FindFirstChildOfClass("Attachment")
Trail2.Attachment1 = Character.LeftLowerLeg:FindFirstChildOfClass("Attachment")
Trail2.Lifetime = 0.2
Trail2.MaxLength = 0.5
Trail2.WidthScale = NumberSequence.new(0.8)
Trail2.FaceCamera = false
local Trail3 = Instance.new("Trail",Character)
Trail3.Attachment0 = Character.LeftLowerArm:FindFirstChildOfClass("Attachment")
Trail3.Attachment1 = Character.LeftHand:FindFirstChildOfClass("Attachment")
Trail3.Lifetime = 0.2
Trail3.MaxLength = 0.5
Trail3.WidthScale = NumberSequence.new(0.8)
Trail3.FaceCamera = false
local Trail4 = Instance.new("Trail",Character)
Trail4.Attachment0 = Character.RightLowerArm:FindFirstChildOfClass("Attachment")
Trail4.Attachment1 = Character.RightHand:FindFirstChildOfClass("Attachment")
Trail4.Lifetime = 0.25
Trail4.MaxLength = 0.5
Trail4.WidthScale = NumberSequence.new(0.8)
Trail4.FaceCamera = false
local Trail5 = Instance.new("Trail",Character)
Trail5.Attachment0 = Character.UpperTorso:FindFirstChildOfClass("Attachment")
Trail5.Attachment1 = Character.LowerTorso:FindFirstChildOfClass("Attachment")
Trail5.Lifetime = 0.25
Trail5.MaxLength = 0.5
Trail5.WidthScale = NumberSequence.new(0.8)
Trail5.FaceCamera = false
wait(.5)
for i = 0,1, .1 do
Trail1.Transparency = NumberSequence.new(i)
Trail2.Transparency = NumberSequence.new(i)
Trail3.Transparency = NumberSequence.new(i)
Trail4.Transparency = NumberSequence.new(i)
Trail5.Transparency = NumberSequence.new(i)
wait()
end
Trail1:Destroy()
Trail2:Destroy()
Trail3:Destroy()
Trail4:Destroy()
Trail5:Destroy()
wait(cooldown)
debounce = false
end
end
end)
end
context:BindAction("Startdash", Onbuttonpress, true, "q")
context:SetTitle("Startdash", "Dash")
context:SetPosition("Onbuttonpress", UDim2.new(0.628, 0,0.767, 0))
Hope this helped
I am not sure... But don't you have to put the end on the same imaginary horizontal line? Or is that for easy reference? Please don't criticise me for my opinion...
2 comments
I have no idea
This should be a comment instead of an answer because it doesn't answer the question...
local player = game.Players.LocalPlayer
local Char = player.Character or player.CharacterAdded:Wait()
local UIS = game:GetService("UserInputService")
local humanoid = player.Character:WaitForChild("Humanoid")
local context = game:GetService("ContextActionService")
local debounce = false
local cooldown = 1 -- Time to wait between 2 dash
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=5311749838"--Insert ID here
local function Onbuttonpress()
if debounce == false then
debounce = true
local playAnim = humanoid:LoadAnimation(anim)
playAnim:Play()
local Character = game.Workspace:WaitForChild(player.Name)
Char.HumanoidRootPart.Velocity = Char.HumanoidRootPart.CFrame.lookVector*500
local Trail1 = Instance.new("Trail",Character)
Trail1.Attachment0 = Character.RightFoot:FindFirstChildOfClass("Attachment")
Trail1.Attachment1 = Character.RightLowerLeg:FindFirstChildOfClass("Attachment")
Trail1.Lifetime = 0.2
Trail1.MaxLength = 1
Trail1.WidthScale = NumberSequence.new(0.8)
Trail1.FaceCamera = false
local Trail2 = Instance.new("Trail",Character)
Trail2.Attachment0 = Character.LeftFoot:FindFirstChildOfClass("Attachment")
Trail2.Attachment1 = Character.LeftLowerLeg:FindFirstChildOfClass("Attachment")
Trail2.Lifetime = 0.2
Trail2.MaxLength = 0.5
Trail2.WidthScale = NumberSequence.new(0.8)
Trail2.FaceCamera = false
local Trail3 = Instance.new("Trail",Character)
Trail3.Attachment0 = Character.LeftLowerArm:FindFirstChildOfClass("Attachment")
Trail3.Attachment1 = Character.LeftHand:FindFirstChildOfClass("Attachment")
Trail3.Lifetime = 0.2
Trail3.MaxLength = 0.5
Trail3.WidthScale = NumberSequence.new(0.8)
Trail3.FaceCamera = false
local Trail4 = Instance.new("Trail",Character)
Trail4.Attachment0 = Character.RightLowerArm:FindFirstChildOfClass("Attachment")
Trail4.Attachment1 = Character.RightHand:FindFirstChildOfClass("Attachment")
Trail4.Lifetime = 0.25
Trail4.MaxLength = 0.5
Trail4.WidthScale = NumberSequence.new(0.8)
Trail4.FaceCamera = false
local Trail5 = Instance.new("Trail",Character)
Trail5.Attachment0 = Character.UpperTorso:FindFirstChildOfClass("Attachment")
Trail5.Attachment1 = Character.LowerTorso:FindFirstChildOfClass("Attachment")
Trail5.Lifetime = 0.25
Trail5.MaxLength = 0.5
Trail5.WidthScale = NumberSequence.new(0.8)
Trail5.FaceCamera = false
wait(.5)
for i = 0,1, .1 do
Trail1.Transparency = NumberSequence.new(i)
Trail2.Transparency = NumberSequence.new(i)
Trail3.Transparency = NumberSequence.new(i)
Trail4.Transparency = NumberSequence.new(i)
Trail5.Transparency = NumberSequence.new(i)
wait()
end
Trail1:Destroy()
Trail2:Destroy()
Trail3:Destroy()
Trail4:Destroy()
Trail5:Destroy()
wait(cooldown)
debounce = false
end
end
context:BindAction("Startdash", Onbuttonpress, true, "q")
context:SetTitle("Startdash", "Dash")
context:SetPosition("Onbuttonpress", UDim2.new(0.628, 0,0.767, 0))
1 comment
This above creats trails and dashes the player in the direction the player is facing
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Dude, please just put your script in code lines. I don't wanna use pastebin lol
k here check my answer