SHOW:
|
|
- or go back to the newest paste.
| 1 | local ts = game:GetService("TweenService") -- gets tweenservice, a handy dandy tool for animating things
| |
| 2 | ||
| 3 | script.Parent.OnServerEvent:Connect(function(plr)-- if the remote event has been fired | |
| 4 | local char = plr.Character -- gets the character | |
| 5 | local root = char.HumanoidRootPart -- gets the root part | |
| 6 | local mountain = game.ReplicatedStorage.mainice:Clone() | |
| 7 | mountain.Parent = char | |
| 8 | ||
| 9 | for i,v in pairs(mountain:GetChildren()) do --loops inside the mountain part | |
| 10 | v.Transparency = 1 --makes the parts inside the mountain hitbox part transparent | |
| 11 | end | |
| 12 | ||
| 13 | mountain.CFrame = root.CFrame + root.CFrame.lookVector * 28 --makes the ice mountains original position | |
| 14 | mountain.Position = mountain.Position + Vector3.new(0,.1,0) | |
| 15 | ||
| 16 | for i,v in pairs(mountain:GetChildren()) do --loops inside the mountain part | |
| 17 | ts:Create(v,TweenInfo.new(.2,0,0),{Transparency = 0}):Play() --animates the parts inside the mountain so they are not transparent
| |
| 18 | end | |
| 19 | ts:Create(mountain,TweenInfo.new(.2,0,0),{CFrame = mountain.CFrame + mountain.CFrame.lookVector * .5,Position = mountain.Position - Vector3.new(0,.15,0)}):Play() --animates the mountain so it moves forwards
| |
| 20 | game.Debris:AddItem(mountain,6) --makes the mountain nonexistent in six seconds | |
| 21 | ||
| 22 | ||
| 23 | --DAMAGE DEALER | |
| 24 | for i,v in pairs(workspace:GetChildren()) do -- look through all the workspace | |
| 25 | if v:FindFirstChild("Humanoid") and v:FindFirstChild("Head") and v.Name ~= plr.Name then --if the thing we are looking in has a humanoid and a head and its name isnt the players name then
| |
| 26 | local dist = (v.Head.Position - mountain.Position).magnitude --find the distance between us and the ting | |
| 27 | if dist < 25 then -- if its less than 35 studs then | |
| 28 | v.Humanoid:TakeDamage(30) -- take 30 damage | |
| 29 | local bv = Instance.new("BodyVelocity",v.HumanoidRootPart) --make the knockback
| |
| 30 | bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) -- maximum force | |
| 31 | bv.Velocity = root.CFrame.lookVector * 45 + Vector3.new(0,35,0) -- the force | |
| 32 | game.Debris:AddItem(bv,.5) --it will last 0.5 seconds | |
| 33 | end | |
| 34 | end | |
| 35 | end | |
| 36 | --back to effects | |
| 37 | ||
| 38 | wait(5) --waits 5 seconds | |
| 39 | for i,v in pairs(mountain:GetChildren()) do --loops inside the mountain part | |
| 40 | ts:Create(v,TweenInfo.new(.4,0,0),{Transparency = 1}):Play() --animates the parts inside the mountain so they are transparency
| |
| 41 | end | |
| 42 | ||
| 43 | end) |