Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by
Sakuzo 5
9 years ago

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

Log in to vote
1
Answered by
Merely 2122 Moderation Voter Community Moderator
9 years ago

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

0
Oh, i found what was wrong. Thanks for the help, Merely. Sakuzo 5 — 9y
1
What was wrong? Merely 2122 — 9y
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. Spongocardo 1991 — 9y
Ad
Log in to vote
0
Answered by
Sakuzo 5
9 years ago

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)`
0
In the future just edit the original post. Merely 2122 — 9y
0
I tried doing that, it made one of the two animations slower than the other. Is there any way to change this? Sakuzo 5 — 9y

Answer this question