Advertisement
Tweak16

ROBLOX Scripting | Bouncepad

May 1st, 2021
2,310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.64 KB | None | 0 0
  1. --[[
  2. Made by Tweakified, Neonblox Games
  3. Youtube Tutorial: https://youtu.be/MjnVL85-J_Q
  4. Discord Support: https://discord.com/invite/JdaFf7p
  5.  
  6. Script Type: Local Script
  7. Script Parent: StarterPlayers -> StarterPlayerScripts
  8. --]]
  9.  
  10. local TweenService = game:GetService("TweenService")
  11. local Players = game:GetService("Players")
  12. local player = Players.LocalPlayer
  13.  
  14. local BouncePadTweenOpenInfo = TweenInfo.new(0.4)
  15. local BouncePadTweenCloseInfo = TweenInfo.new(0.2)
  16.  
  17. local BounceSound = workspace:WaitForChild("BounceEffect")
  18.  
  19. local function BouncepadEffect(char, BouncePadModel)
  20.     local HumanoidRootPart = char.PrimaryPart
  21.     if HumanoidRootPart ~= nil then
  22.         local TempBounceInProgress = BouncePadModel:WaitForChild("BounceInProgress")
  23.         if TempBounceInProgress.Value == false then
  24.             TempBounceInProgress.Value = true
  25.            
  26.             local Pad = BouncePadModel.PrimaryPart
  27.             Pad.CanCollide = false
  28.            
  29.             local BounceVelocity = Instance.new("BodyVelocity")
  30.             BounceVelocity.Name = "BounceVelocity"
  31.             BounceVelocity.Velocity = Vector3.new(0, BouncePadModel:WaitForChild("Power").Value, 0)
  32.             BounceVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  33.             BounceVelocity.P = math.huge
  34.             BounceVelocity.Parent = HumanoidRootPart
  35.            
  36.             spawn(function()
  37.                 wait(BouncePadModel:WaitForChild("Time").Value)
  38.                 BounceVelocity:Destroy()
  39.             end)
  40.            
  41.             local CoinMesh = BouncePadModel:WaitForChild("Coil"):WaitForChild("Mesh")
  42.            
  43.             local TempTween1 = TweenService:Create(CoinMesh, BouncePadTweenOpenInfo, {Scale = Vector3.new(CoinMesh.Scale.X, CoinMesh.Scale.Y, CoinMesh.Scale.Z + 2)})
  44.             local TempTween2 = TweenService:Create(Pad, BouncePadTweenOpenInfo, {CFrame = Pad.CFrame + Vector3.new(0, 4, 0)})
  45.            
  46.             TempTween1:Play()
  47.             TempTween2:Play()
  48.             BounceSound:Play()
  49.            
  50.             wait(0.1)
  51.             Pad.CanCollide = true
  52.             wait(0.4)
  53.            
  54.             local TempTween3 = TweenService:Create(CoinMesh, BouncePadTweenCloseInfo, {Scale = Vector3.new(CoinMesh.Scale.X, CoinMesh.Scale.Y, CoinMesh.Scale.Z - 2)})
  55.             local TempTween4 = TweenService:Create(Pad, BouncePadTweenCloseInfo, {CFrame = Pad.CFrame - Vector3.new(0, 4, 0)})
  56.            
  57.             TempTween3:Play()
  58.             TempTween4:Play()
  59.            
  60.             TempTween4.Completed:Wait()
  61.             TempBounceInProgress.Value = false
  62.         end
  63.     end
  64. end
  65.  
  66. local BouncePadFolder = workspace:WaitForChild("BouncePads")
  67. for _,BouncePad in pairs(BouncePadFolder:GetChildren()) do
  68.     BouncePad.PrimaryPart.Touched:Connect(function(hit)
  69.         local char = hit.Parent
  70.         if char ~= nil then
  71.             local TempPlayer = Players:GetPlayerFromCharacter(char)
  72.             if TempPlayer ~= nil and player == TempPlayer then
  73.                 BouncepadEffect(char, BouncePad)
  74.             end
  75.         end
  76.     end)
  77. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement