Advertisement
KashTheKingYT

Powerup Script

Nov 6th, 2021
1,375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. local part = script.Parent
  2. local powerupSpeed = 20
  3. local debounce = false
  4. local regularWalkspeed = game.StarterPlayer.CharacterWalkSpeed
  5. local timer = 5
  6. local particleEmitter = part.ParticleEmitter
  7. local soundEffect = part.SoundEffect
  8.  
  9. part.Touched:Connect(function(hit)
  10.     if hit.Parent:FindFirstChild("Humanoid") and debounce == false
  11.     then
  12.         debounce = true
  13.         part.Transparency = 1
  14.         soundEffect:Play()
  15.         local char = hit.Parent
  16.         local humanoid = char:WaitForChild("Humanoid")
  17.         humanoid.WalkSpeed = powerupSpeed
  18.         particleEmitter.Parent = char.HumanoidRootPart
  19.         wait(timer)
  20.         humanoid.WalkSpeed = regularWalkspeed
  21.         debounce = false
  22.         particleEmitter:Destroy()
  23.         part:Destroy()
  24.     end
  25. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement