Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This script picks a random animation and plays it when you attack.
- math.randomseed(os.time());math.random();math.random();math.random();-- math.random() fix
- local sword = script.Parent
- local handle = sword:WaitForChild("Handle")
- local anims = sword:WaitForChild("Animations"):GetChildren()
- local mouse = game.Players.LocalPlayer:GetMouse()
- local enabled = true
- Sounds = {{145180529, "Slash"}, {145180550, "Slash"}}
- SlashSounds = {}
- local UnsheathSound = Instance.new("Sound")
- UnsheathSound.SoundId = "http://www.roblox.com/Asset/?id=145180523"
- UnsheathSound.Parent = sword
- UnsheathSound.Volume = .2
- function attack()
- if not enabled then
- return
- end
- local humanoid = sword.Parent.Humanoid
- local currAnim = humanoid:LoadAnimation(anims[math.random(#anims)])-- pick a random animation
- enabled = false
- mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
- currAnim:Play()
- wait(.75)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- enabled = true
- SlashSounds[math.random(#SlashSounds)]:Play()
- end
- function spinsword(spintime)
- delay(0,function()
- local startspin=tick()
- local endspin=startspin+spintime
- while tick()<endspin do
- sp.Grip=currentgrip*CFrame.Angles(math.pi*2*((tick()-startspin)/spintime),0,0)
- wait()
- end
- sp.Grip = currentgrip
- end)
- end
- sword.Equipped:Connect(function()
- UnsheathSound:play()
- atConn = mouse.Button1Down:Connect(attack)
- end)
- sword.Unequipped:Connect(function()
- atConn:Disconnect()-- I forgot how2tool
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement