Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- FireBalls --
- Player = game.Players.LocalPlayer
- Mouse = Player:GetMouse()
- function Path(Block,Speed,Color)
- local Parts = {}
- game:GetService("RunService").RenderStepped:connect(function()
- if Block:IsDescendantOf(Workspace) then
- local P = Parts[#Parts]
- if P then
- local G = Instance.new("Part",Workspace)
- if Color then
- G.BrickColor = Color
- end
- G.Anchored = true
- G.FormFactor = "Custom";G.CanCollide = false
- G.TopSurface = "Smooth"
- G.BottomSurface = "Smooth"
- local Dis = ((P.CFrame*CFrame.new(0,0,-P.Size.Z/2)).p-Block.CFrame.p).magnitude
- G.Size = Vector3.new(0,0,Dis)
- G.CFrame = CFrame.new((P.CFrame*CFrame.new(0,0,-P.Size.Z/2)).p,Block.CFrame.p)*CFrame.new(0,0,-Dis/2)
- table.insert(Parts,G)
- else
- local G = Instance.new("Part",Workspace)
- G.Anchored = true
- G.FormFactor = 'Custom'
- G.Size = Vector3.new(0,0,0)
- G.CFrame = Block.CFrame
- table.insert(Parts,G)
- end
- end
- for i,v in pairs(Parts) do
- if v.Transparency < 1 then
- v.Transparency = v.Transparency +Speed
- else
- table.remove(Parts,i)
- v:Destroy()
- end
- end
- end)
- end
- local Balls = {}
- local All = {}
- function MakeBall()
- local P = Instance.new("Part",Player.Character)
- P.Anchored = true
- P.FormFactor = "Custom"
- P:breakJoints()
- P.Size = Vector3.new(1,1,1)
- P.CanCollide = false
- P.CFrame = CFrame.new(0,20,0)
- local PM = Instance.new("SpecialMesh",P)
- PM.MeshType = "Sphere"
- Path(P,0.1)
- local B = {}
- B.Velocity = Vector3.new(0,0,0)
- B.Target = Vector3.new(0,0,0)
- B.Part = P
- table.insert(Balls,B)
- table.insert(All,B)
- return B
- end
- for i = 1,3 do
- print(MakeBall())
- end
- local N = 0
- game:GetService("RunService").RenderStepped:connect(function()
- N = N +1
- for i,v in pairs(Balls) do
- if v.Part:IsDescendantOf(Workspace) then
- if not v.Shooting then
- v.Target = (
- Player.Character.Torso.CFrame
- *CFrame.Angles(0,((math.rad(360)/#Balls)*i)+math.rad(N),0)
- *CFrame.new(0,math.sin(i+N/10),#Balls*2)
- *CFrame.Angles(0,math.rad(N*3),0)
- *CFrame.new(0,0,2)
- ).p
- v.Velocity = -(v.Part.Position-v.Target)*0.1
- end
- else
- table.remove(Balls,i)
- end
- end
- for i,v in pairs(All) do
- if v.Part:IsDescendantOf(Workspace) then
- if v.Shooting then
- local hit,pos = Workspace:FindPartOnRay(Ray.new(v.Part.CFrame.p,(v.Part.CFrame*CFrame.new(0,0,2)).p),game.Players.LocalPlayer.Character)
- if not hit then
- v.Part.CFrame = v.Part.CFrame +v.Velocity
- elseif v.Shooting then
- v.Part.CFrame = CFrame.new(pos)
- wait(0.5)
- Instance.new("Explosion",Workspace).Position = v.Part.Position
- v.Part:Destroy()
- end
- end
- else
- table.remove(All,i)
- end
- end
- end)
- Mouse.Button1Down:connect(function()
- local B = Balls[1]
- if B then
- table.remove(Balls,1)
- B.Shooting = true
- B.Velocity = -(B.Part.Position-Mouse.Hit.p)*0.1
- end
- end)
- Mouse.KeyDown:connect(function(k)
- if k == "n" then
- if #Balls < 6 then
- MakeBall()
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement