Created
April 25, 2024 01:12
-
-
Save ahmed-shariff/75b30f08daea466ef137f9d5879b2cde to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local Players = game:GetService("Players") | |
| local projectileBase = script.Parent.projectile | |
| local prompt = script.Parent.ProximityPrompt | |
| prompt.Triggered:Connect(function (player) | |
| shootProjectile(30, 0.95, 2, 10) | |
| end) | |
| -- example call: shootProjectile(30, 0.95, 2, 10) | |
| function shootProjectile(speed, antiGravity, waitTime, damageTaken) | |
| local projectile = script.Parent.projectile:Clone() | |
| projectile.Parent = workspace | |
| projectile.Touched:Connect(function(touched) | |
| local human = touched.Parent:FindFirstChildWhichIsA("Humanoid") | |
| if human then | |
| human:TakeDamage(damageTaken) | |
| end | |
| end) | |
| projectile.CFrame = projectile.CFrame - script.Parent.CFrame.XVector.Unit * 0.5 | |
| projectile.Anchored = false | |
| projectile.Velocity = -script.Parent.CFrame.XVector.Unit * speed | |
| projectile.VectorForce.Force = Vector3.new(0, projectile.AssemblyMass * workspace.Gravity * antiGravity ,0) | |
| wait(waitTime) | |
| projectile:Destroy() | |
| end | |
| while true do | |
| wait(3) | |
| shootProjectile(30, 0.95, 2, 10) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment