Advertisement
DragonKillerz

Doors Custom Vitamins Script

Mar 22nd, 2023
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. getgenv().CustomVitamins = {
  2.     SpeedBoost = 7,
  3.     EffectDuration = 7.5
  4. }
  5.  
  6. local tool = game:GetObjects("rbxassetid://12827538877")[1]
  7. tool.Parent = game.Players.LocalPlayer.Backpack
  8.  
  9. local anim = Instance.new("Animation")
  10. anim.Name = "idle"
  11. anim.AnimationId = "rbxassetid://10479585177"
  12. local idle = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(anim)
  13.  
  14. local anim = Instance.new("Animation")
  15. anim.Name = "open"
  16. anim.AnimationId = "rbxassetid://10482563149"
  17. local use = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(anim)
  18.  
  19. tool.Equipped:Connect(function()
  20.     idle:Play()
  21. end)
  22.  
  23. tool.Unequipped:Connect(function()
  24.     idle:Stop()
  25. end)
  26.  
  27. local using = false
  28. tool.Activated:Connect(function()
  29.     if using == false then
  30.         using = true
  31.         use:Play()
  32.         tool.Handle.sound_open:Play()
  33.         task.wait(0.5)
  34.         using = false
  35.         tool:Destroy()
  36.         use:Stop()
  37.         local OldSpeedBoost = game.Players.LocalPlayer.Character.Humanoid:GetAttribute("SpeedBoost")
  38.         game.Players.LocalPlayer.Character.Humanoid:SetAttribute("SpeedBoost", getgenv().CustomVitamins.SpeedBoost + OldSpeedBoost)
  39.         task.wait(getgenv().CustomVitamins.EffectDuration)
  40.         game.Players.LocalPlayer.Character.Humanoid:SetAttribute("SpeedBoost", OldSpeedBoost)
  41.     end
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement