Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local module = {}
- rs = game:GetService('RunService')
- function lerpcframe(object, endcf, step)
- local d = coroutine.wrap(function()
- local save = object.CFrame
- for i=0,1, step do
- wait()
- object.CFrame = save:lerp(endcf, i)
- end
- end)
- d()
- end
- module.startcombat = function(npc, player)
- print("yup")
- player.HumanoidRootPart.Anchored = true
- player.Humanoid.WalkSpeed = 0
- npc.Humanoid.WalkSpeed = 0
- npc.HumanoidRootPart.Anchored = true
- game.ReplicatedStorage.StartCombat:FireClient(game.Players[player.Name], npc, 2)
- lerpcframe(player.HumanoidRootPart, CFrame.new(player.HumanoidRootPart.Position, npc.HumanoidRootPart.Position), .025)
- lerpcframe(npc.HumanoidRootPart, CFrame.new(npc.HumanoidRootPart.Position, player.HumanoidRootPart.Position), .025)
- wait(2)
- local fire1 = Instance.new('Fire')
- fire1.Color = Color3.new(255,255,255)
- local circle1 = game.ReplicatedStorage.range:Clone()
- circle1.Parent = game.Lighting
- local circle2 = game.ReplicatedStorage.range:Clone()
- local beam = Instance.new('Part', game.Workspace)
- beam.Transparency = 0
- beam.Material = "Neon"
- beam.Size = Vector3.new(1,1,.1)
- beam.Anchored = true
- beam.CanCollide = false
- beam.Color = Color3.fromRGB(0,200,180)
- local beam2 = beam:Clone()
- local beam3 = beam:Clone()
- local beam4 = beam:Clone()
- local beam5 = beam:Clone()
- local beam6 = beam:Clone()
- beam2.Parent = game.Workspace
- beam3.Parent = game.Workspace
- beam4.Parent = game.Workspace
- beam5.Parent = game.Workspace
- beam6.Parent = game.Workspace
- local tables = {beam, beam2, beam3, beam4, beam5, beam6}
- local dist = (npc.HumanoidRootPart.Position - player.HumanoidRootPart.Position).magnitude
- --fire1.Parent = npc.HumanoidRootPart
- circle1.Parent = game.Workspace
- circle1.CFrame = npc.HumanoidRootPart.CFrame
- local pos = npc.HumanoidRootPart.Position:lerp(player.HumanoidRootPart.Position, .5)
- local pos1 = pos + (npc.HumanoidRootPart.CFrame.rightVector * (dist/4))
- local pos2 = pos + (npc.HumanoidRootPart.CFrame.rightVector * -(dist/4))
- local dist2 = (npc.HumanoidRootPart.Position - pos1).magnitude
- local dist3 = (pos1 - pos2).magnitude
- for i = 1, 100, .8 do
- beam.Size = Vector3.new(1,1, dist * (i/100))
- beam.CFrame = CFrame.new(npc.HumanoidRootPart.Position, player.HumanoidRootPart.Position)
- beam.CFrame = beam.CFrame + (beam.CFrame.lookVector * (beam.Size.Z/2))
- beam2.Size = Vector3.new(1,1, dist2 * (i/100))
- beam3.Size = Vector3.new(1,1, dist2 * (i/100))
- beam4.Size = Vector3.new(1,1, dist2 * (i/100))
- beam5.Size = Vector3.new(1,1, dist2 * (i/100))
- beam2.CFrame = CFrame.new(npc.HumanoidRootPart.Position, pos1)
- beam3.CFrame = CFrame.new(npc.HumanoidRootPart.Position, pos2)
- beam4.CFrame = CFrame.new(player.HumanoidRootPart.Position, pos1)
- beam5.CFrame = CFrame.new(player.HumanoidRootPart.Position, pos2)
- beam2.CFrame = beam2.CFrame + (beam2.CFrame.lookVector * (beam2.Size.Z/2))
- beam3.CFrame = beam3.CFrame + (beam3.CFrame.lookVector * (beam3.Size.Z/2))
- beam4.CFrame = beam4.CFrame + (beam4.CFrame.lookVector * (beam4.Size.Z/2))
- beam5.CFrame = beam5.CFrame + (beam5.CFrame.lookVector * (beam5.Size.Z/2))
- for a,b in pairs(tables) do
- b.CFrame = b.CFrame - Vector3.new(0,2,0)
- end
- rs.Stepped:Wait()
- end
- for i=0,1,.1 do
- for a,b in pairs(tables) do
- if b ~= beam then
- b.Transparency = i
- end
- end
- wait()
- end
- for a,b in pairs(tables) do
- if b ~= beam then
- b:Destroy()
- end
- end
- fire2 = fire1:Clone()
- -- fire2.Parent = player.HumanoidRootPart
- circle2.Parent = game.Workspace
- circle2.CFrame = player.HumanoidRootPart.CFrame
- end
- return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement