Every time I try adjust the speed of the strikes, it stays at the same speed it was before I tried editing it. Maybe I forgot to edit one part of the script or something, but please show me how to change the speed 1.1 instead of 0.45
Power = false
slash = false
Debounce = false
function onButton1Down(mouse)
Master = game.Players.LocalPlayer
mouse = Master:GetMouse()
function SwordDamage()
humanoid:TakeDamage(1+Master.stats.Level.Value*1.5)
Master.stats.EXP.Value = Master.stats.EXP.Value + humanoid.MaxHealth * 0.1
end
X = math.random(1,2)
if X == 1 then
if slash == false then
slash = true
script.Parent.Tool.Handle.Attack1:Play()
animation = Master.Character.Humanoid:LoadAnimation(script.Parent.RightSlash)
animation:Play(nil,nil,2)
Master.Character.Tool.Blade.Touched:connect(function (hit)
humanoid = hit.Parent:findFirstChild("Enemy")
if humanoid and humanoid ~= Master.Character.Humanoid then
if Debounce == false then
Debounce = true
o = Instance.new("ObjectValue")
o.Name = "creator"
o.Value = Master
o.Parent = humanoid
if slash == true and Debounce == true then
SwordDamage()
end
wait(0.45)
Debounce = false
o:Destroy()
end
end
end)
wait(0.45)
slash = false
end
end
if X == 2 then
if slash == false then
slash = true
script.Parent.Tool.Handle.Attack2:Play()
animation = Master.Character.Humanoid:LoadAnimation(script.Parent.LeftSlash)
animation:Play(nil,nil,2)
Master.Character.Tool.Blade.Touched:connect(function (hit)
humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid and humanoid ~= Master.Character.Humanoid then
if Debounce == false then
Debounce = true
o = Instance.new("ObjectValue")
o.Name = "creator"
o.Value = Master
o.Parent = humanoid
if slash == true and Debounce == true then
SwordDamage()
end
wait(0.45)
Debounce = false
o:Destroy()
end
end
end)
wait(0.45)
slash = false
end
end
end
function onEnabled(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
script.Parent.Selected:connect(onEnabled)*
*``
The wait statements don't affect how fast the animation plays. It's the third argument of AnimationTrack:Play() that affects how fast the animation is.
animation:Play(nil,nil,2)
You should change that 2 to something smaller if you want to slow down the animation.
http://wiki.roblox.com/index.php?title=API:Class/AnimationTrack/Play
Oops, the code didn't come out right, it's supposed to look like this:
Power = false slash = false Debounce = false function onButton1Down(mouse) Master = game.Players.LocalPlayer mouse = Master:GetMouse() function SwordDamage() humanoid:TakeDamage(1+Master.stats.Level.Value*1.5) Master.stats.EXP.Value = Master.stats.EXP.Value + humanoid.MaxHealth * 0.1 end X = math.random(1,2) if X == 1 then if slash == false then slash = true script.Parent.Tool.Handle.Attack1:Play() animation = Master.Character.Humanoid:LoadAnimation(script.Parent.RightSlash) animation:Play(nil,nil,2) Master.Character.Tool.Blade.Touched:connect(function (hit) humanoid = hit.Parent:findFirstChild("Enemy") if humanoid and humanoid ~= Master.Character.Humanoid then if Debounce == false then Debounce = true o = Instance.new("ObjectValue") o.Name = "creator" o.Value = Master o.Parent = humanoid if slash == true and Debounce == true then SwordDamage() end wait(0.45) Debounce = false o:Destroy() end end end) wait(0.45) slash = false end end if X == 2 then if slash == false then slash = true script.Parent.Tool.Handle.Attack2:Play() animation = Master.Character.Humanoid:LoadAnimation(script.Parent.LeftSlash) animation:Play(nil,nil,2) Master.Character.Tool.Blade.Touched:connect(function (hit) humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid and humanoid ~= Master.Character.Humanoid then if Debounce == false then Debounce = true o = Instance.new("ObjectValue") o.Name = "creator" o.Value = Master o.Parent = humanoid if slash == true and Debounce == true then SwordDamage() end wait(0.45) Debounce = false o:Destroy() end end end) wait(0.45) slash = false end end end function onEnabled(mouse) mouse.Button1Down:connect(function() onButton1Down(mouse) end) end script.Parent.Selected:connect(onEnabled)`