Advertisement
HowToRoblox

PotionHandler

Apr 26th, 2020
2,014
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. local drinkAnim = script:WaitForChild("DrinkAnimation")
  2.  
  3. local drinkSound = script:WaitForChild("DrinkSound")
  4.  
  5.  
  6. local potion = script.Parent
  7.  
  8.  
  9. potion.Activated:Connect(function()
  10.    
  11.     if not potion:FindFirstChild("Contents") then return end
  12.    
  13.    
  14.     local char = potion.Parent
  15.    
  16.     local humanoid = char:FindFirstChild("Humanoid")
  17.    
  18.    
  19.     if humanoid then
  20.        
  21.        
  22.         local loadedAnim = humanoid:LoadAnimation(drinkAnim)
  23.        
  24.         loadedAnim:Play()
  25.        
  26.        
  27.         drinkSound:Play()
  28.        
  29.        
  30.         loadedAnim.Stopped:Wait()
  31.        
  32.        
  33.         potion.Contents:Destroy()
  34.        
  35.        
  36.         humanoid.WalkSpeed = 30
  37.        
  38.         wait(5)
  39.        
  40.         humanoid.WalkSpeed = 16
  41.     end
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement