Advertisement
qsenko1

TweeningPositionLava+Damage

May 8th, 2021
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.93 KB | None | 0 0
  1. local debounce = true
  2. local debounce2 = true
  3. local debounce3 = true
  4. local debounce4 = true
  5.  
  6. local lava1 = script.Parent.Lava1
  7. local lava2 = script.Parent.Lava2
  8. local lava3 = script.Parent.Lava3
  9. local lava4 = script.Parent.Lava4
  10.  
  11. function onTouched(hit)
  12.     if hit.Parent:findFirstChild("Humanoid")and debounce then
  13.         debounce =false
  14.         hit.Parent.Humanoid:TakeDamage(25)
  15.         wait(1)
  16.         debounce = true
  17.     end
  18. end
  19.  
  20. lava1.Touched:connect(onTouched)
  21.  
  22. function onTouched2(hit)
  23.     if hit.Parent:findFirstChild("Humanoid")and debounce2 then
  24.         debounce2 =false
  25.         hit.Parent.Humanoid:TakeDamage(25)
  26.         wait(1)
  27.         debounce2 = true
  28.     end
  29. end
  30.  
  31. lava2.Touched:connect(onTouched2)
  32.  
  33. function onTouched3(hit)
  34.     if hit.Parent:findFirstChild("Humanoid")and debounce3 then
  35.         debounce3 =false
  36.         hit.Parent.Humanoid:TakeDamage(25)
  37.         wait(1)
  38.         debounce3 = true
  39.     end
  40. end
  41.  
  42. lava3.Touched:connect(onTouched3)
  43.  
  44. function onTouched4(hit)
  45.     if hit.Parent:findFirstChild("Humanoid")and debounce4 then
  46.         debounce4 =false
  47.         hit.Parent.Humanoid:TakeDamage(25)
  48.         wait(1)
  49.         debounce4 = true
  50.     end
  51. end
  52.  
  53. lava4.Touched:connect(onTouched4)
  54.  
  55. local TweenService = game:GetService("TweenService")
  56. local tweenInfo = TweenInfo.new(
  57.     2, -- Time
  58.     Enum.EasingStyle.Bounce, -- EasingStyle
  59.     Enum.EasingDirection.InOut, -- EasingDirection
  60.     -1, -- RepeatCount (when less than zero the tween will loop indefinitely)
  61.     true, -- Reverses (tween will reverse once reaching it's goal)
  62.     0 -- DelayTime
  63. )
  64.  
  65. local tween = TweenService:Create(lava1, tweenInfo, {Position = Vector3.new(752.156, 716.589, 851.978)})
  66. local tween2 = TweenService:Create(lava2, tweenInfo, {Position = Vector3.new(752.156, 729.581, 841.517)})
  67. local tween3 = TweenService:Create(lava3, tweenInfo, {Position = Vector3.new(752.156, 716.572, 831.246)})
  68. local tween4 = TweenService:Create(lava4, tweenInfo, {Position = Vector3.new(752.156, 716.598, 862.528)})
  69.  
  70. tween:Play()
  71. tween2:Play()
  72. tween3:Play()
  73. tween4:Play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement