Advertisement
seeseekeepeeshee

Untitled

Jun 6th, 2025
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. local launcher = script.Parent
  2. local clickDetector = launcher:WaitForChild("ClickDetector")
  3.  
  4. clickDetector.MouseClick:Connect(function(player)
  5. -- Create the projectile
  6. local projectile = Instance.new("Part")
  7. projectile.Shape = Enum.PartType.Ball
  8. projectile.Size = Vector3.new(1, 1, 1)
  9. projectile.BrickColor = BrickColor.new("Bright red")
  10. projectile.Material = Enum.Material.Neon
  11. projectile.Position = launcher.Position + launcher.CFrame.LookVector * 3
  12. projectile.Anchored = false
  13. projectile.CanCollide = true
  14. projectile.Parent = workspace
  15.  
  16. -- Add velocity
  17. local bodyVelocity = Instance.new("BodyVelocity")
  18. bodyVelocity.Velocity = launcher.CFrame.LookVector * 100
  19. bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
  20. bodyVelocity.Parent = projectile
  21.  
  22. -- Detect hits
  23. projectile.Touched:Connect(function(hit)
  24. if hit:IsDescendantOf(launcher) then return end -- Prevent hitting self
  25. if hit.Parent:FindFirstChild("Humanoid") then
  26. hit.Parent.Humanoid:TakeDamage(25)
  27. end
  28. projectile:Destroy()
  29. end)
  30.  
  31. -- Auto-destroy after 5 seconds
  32. game.Debris:AddItem(projectile, 5)
  33. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement