Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why can't I adjust the speed of the strikes?

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)**``

2 answers

✓ Accepted answer

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

3 comments

0

Oh, i found what was wrong. Thanks for the help, Merely.

1

What was wrong?

0

You should say what was wrong in your script. It helps people with the same problem as you in the future. They can just look at your thread, find your solution and fix it without hassle.

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)`

2 comments

0

In the future just edit the original post.

0

I tried doing that, it made one of the two animations slower than the other. Is there any way to change this?

This discussion is preserved as it was. New answers, comments, and votes are closed.