Advertisement
KashTheKingYT

Powerup 2

Nov 7th, 2021
1,247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. local part = script.Parent
  2. local powerupSpeed = 20
  3. local debounce = false
  4. local timer = 15
  5. local particleEmitter = part.ParticleEmitter
  6. local soundEffect = part.SoundEffect
  7.  
  8. part.Touched:Connect(function(hit)
  9.     if hit.Parent:FindFirstChild("Humanoid") and debounce == false and not hit.Parent:FindFirstChild("Powerup")
  10.     then
  11.         debounce = true
  12.         local powerup = Instance.new("StringValue", hit.Parent)
  13.         powerup.Name = "Powerup"
  14.         part.Transparency = 1
  15.         soundEffect:Play()
  16.         local char = hit.Parent
  17.         local humanoid = char:WaitForChild("Humanoid")
  18.         particleEmitter.Parent = char.HumanoidRootPart
  19.        
  20.         local humChildren = humanoid:GetChildren()
  21.         for i,child in pairs(humChildren) do
  22.             if child:isA("NumberValue") then
  23.                 child.Value = 5
  24.                 humanoid.WalkSpeed = 32
  25.                 if child.Name == "BodyProportionScale" then
  26.                     child.Value = 0
  27.                 end
  28.                 if child.Name == "BodyTypeScale" then
  29.                     child.Value = 0
  30.                 end
  31.             end
  32.         end
  33.        
  34.         wait(timer)
  35.         for i,child in pairs(humChildren) do
  36.             if child:isA("NumberValue") then
  37.                 child.Value = 1
  38.                 humanoid.WalkSpeed = 16
  39.                 if child.Name == "BodyTypeScale" then
  40.                     child.Value = 0
  41.                 end
  42.                 if child.Name == "BodyHeightScale" then
  43.                     child.Value = 1.05
  44.                 end
  45.                 if child.Name == "BodyProportionScale" then
  46.                     child.Value = 0
  47.                 end
  48.             end
  49.         end
  50.         debounce = false
  51.         particleEmitter:Destroy()
  52.         powerup:Destroy()
  53.         part:Destroy()
  54.     end
  55. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement