Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SETTINGS
- local amount = math.random(1,5) -- Randomize the number of "launches"
- local meteorO = game.ServerStorage:WaitForChild("Items"):WaitForChild("RegidragoMeteor") -- Fetch the meteor
- local shockwaveO = game.ServerStorage:WaitForChild("Items"):WaitForChild("RegidragoShockwave") -- Fetch the shockwave
- local DamageMod = require(game.ServerScriptService.Libraries.DamageService) -- Fetch DamageService
- local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Fetch ReplicatedStorage (for screen shake)
- local remoteEvent = ReplicatedStorage:WaitForChild("SCREENSHAKE") -- Fetch the RemoteEvent from ReplicatedStorage (for screen shake)
- -- SCRIPT
- function Use(...)
- local args = {...}
- local meteortarget = CFrame.new(args[1].Torso.Position.X, args[1].Torso.Position.Y - 25, args[1].Torso.Position.Z) -- Save the spot 25 studs below the boss as a CFrame value, as target for velocity calc later
- local belowposition = CFrame.new(args[1].Torso.CFrame.p) -- Save the boss' spot on the ground as a CFrame, so shockwave will spawn there
- args[1].Humanoid.JumpPower = 150
- args[1].Humanoid.Jump = true
- wait(1.25)
- args[1].Humanoid.JumpPower = 100
- for i = 1, amount do
- local meteor = meteorO:Clone()
- meteor.Parent = args[1]
- meteor.CFrame = args[1].Torso.CFrame
- local bv = Instance.new("BodyVelocity")
- bv.Parent = meteor
- bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
- bv.velocity = (meteortarget.p - args[1].Torso.Position) -- Script requires two Vector3 values for BodyVelocity.velocity, and position is a Vector3 value. The meteor will travel to meteortarget.p from the boss' Torso.Position in 1 second.
- game:GetService("Debris"):AddItem(meteor, 2)
- args[1]:FindFirstChild("Humanoid"):ChangeState(Enum.HumanoidStateType.Jumping) -- Double jump shenans
- wait(0.6) -- Wait for meteor to hit the ground
- local funnyrandom = math.random(1,4) * 5.625 -- I wanted to make the shockwaves change their angles randomly such that there are no easy safe spots
- for _, i in pairs(game.Players:GetPlayers()) do
- if (args[1].Torso.Position - i.Character.Torso.Position).Magnitude < 250 then
- remoteEvent:FireClient(i, 250 - (args[1].Torso.Position - i.Character.Torso.Position).Magnitude) -- Screen shake shenans (there's a separate script on the client-side that handles the shaking itself, this just tells the script to start) (ignre pls)
- end
- end
- for i = 1,3 do -- Run the FULL shockwave creation script three times (for 1st, 2nd, 3rd sets)
- local sizemultiplier = 4 - i -- first wave will multiply by 3, second will multiply by 2, third will multiply by 1
- for q = 1, 16 do -- Run the singular shockwave creation script sixteen times (for 16 different directions)
- local shockwave = shockwaveO:Clone()
- shockwave.Parent = args[1]
- shockwave.CFrame = args[1].Torso.CFrame + CFrame.new(0, belowposition.Y - args[1].Torso.Position.Y - 4.8 + (sizemultiplier * 3.5), 0).p
- -- We set the CFrame to the boss' Torso, so it will be at the same position
- -- as the boss' Torso AS WELL AS FACING THE SAME DIRECTION. Then we set the
- -- y-coordinate to the boss' ground position (belowposition) (we need to subtract
- -- args[1].Torso.Position.Y in order to get rid of the y-coordinate from
- -- args[1].Torso.CFrame), then do a little math to ensure that all shockwaves
- -- travel along the floor.
- -- At this point, the shockwave is directly below the boss and on the floor, and
- -- faces the same direction as it. However, it hasn't been spawned yet.
- shockwave.CFrame = shockwave.CFrame * CFrame.Angles(0, math.rad(22.5 * q + funnyrandom), 0)
- -- We let it keep the CFrame we just set and then rotate it along the y-axis
- -- (horizontal rotation). This rotation is as follows:
- -- What number shockwave are you on (the variable q)? Multiply that by 22.5. (exactly 360/16)
- -- What was the random number (the variable funnyrandom)? Add that. (will be a multiple of 5.625)
- -- (btw 5.625 is exactly a quarter of 22.5)
- -- Then, convert that to degrees with math.rad(). Here's an example:
- -- My random value is 0. Therefore, all my rotations will be shifted 0
- -- degrees, clockwise. This is essentially a useless rotation and does
- -- nothing. Sake of simplicity.
- -- 22.5 is equivalent to 360/16, so I will call it 1/16 of a circle.
- -- My 1st shockwave spawns at 1/16 of a circle, clockwise.
- -- My 3rd shockwave spawns at 3/16 of a circle, clockwise. etc
- -- My 16th and final shockwave spawns at 16/16 of a circle,
- -- which is equivalent to 0 degrees, so directly forward. (360 deg = 0 deg)
- -- Therefore, this line of code makes the shockwaves spawn in a
- -- neat 16-piece bouquet, evenly spaced.
- local bv = Instance.new("BodyVelocity")
- bv.Parent = shockwave
- bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
- bv.velocity = shockwave.CFrame.lookVector * 50
- -- CFrame.lookVector is worth exactly 1 stud. If I were
- -- to set the velocity to just shockwave.CFrame.lookVector,
- -- it would travel a 1-stud distance in 1 second.
- -- We multiply by 50 so that it will travel the direction
- -- that it faces in at 50 studs per second.
- shockwave.Size = shockwave.Size * sizemultiplier / 3 -- Apply the size multiplier to the shockwave
- DamageMod:RegisterWeaponPart(args[1], {shockwave}, sizemultiplier * 15) -- Arguments are the stuffs in the parentheses. First argument is a whitelist for who's immune to the weapon. Second argument is what the weapon is. Third argument is the damage the weapon deals. I wanted my bigger shockwaves to hurt more, so I put the sizemultiplier there.
- game:GetService("Debris"):AddItem(shockwave, 5) -- Create the shockwave with Debris service
- end
- wait(0.15) -- Wait a little so the 1st 2nd 3rd sets aren't bunched up
- end
- end
- end
- return Use
Add Comment
Please, Sign In to add comment