Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do --rayCast
- function rayCast(startpos, Speed, Gravity, Dmg, color)
- local ran,err = ypcall(function()
- local rayPart = Instance.new("Part")
- rayPart.Name = "RayPart"
- rayPart.BrickColor = BrickColor.new(color)
- rayPart.Anchored = true
- rayPart.CanCollide = false
- rayPart.Locked = true
- rayPart.FormFactor = "Custom"
- rayPart.TopSurface = Enum.SurfaceType.Smooth
- rayPart.BottomSurface = Enum.SurfaceType.Smooth
- rayPart.Size = Vector3.new(.2, 50, .2)
- rayPart:breakJoints()
- Instance.new("CylinderMesh", rayPart)
- local fire = Instance.new("Fire", rayPart)
- fire.Color = rayPart.BrickColor.Color
- fire.SecondaryColor = rayPart.BrickColor.Color
- fire.Heat = 0
- fire.Size = 10
- local pl = Instance.new("PointLight", rayPart)
- pl.Color = Color3.new(rayPart.BrickColor.r/1.5, rayPart.BrickColor.g/1.5, rayPart.BrickColor.b/1.5)
- pl.Range = 18
- local hitobj = false
- local bulletposition = startpos.Position
- rayPart.CFrame = startpos.CFrame
- trailconnect(rayPart, hitobj)
- local bulletvelocity = (Vector3.new(math.random(-2,2), math.random(-2,2), math.random(-2,2)))+( mouse.Hit.p - bulletposition).unit*Speed
- local bulletlastposition = bulletposition
- coroutine.resume(coroutine.create(function()
- while true do
- local dt = wait()
- bulletlastposition = bulletposition
- bulletvelocity = bulletvelocity + (Vector3.new(0, -3.81*Gravity, 0)*dt)
- bulletposition = bulletposition + (bulletvelocity*dt)
- local ray = Ray.new(bulletlastposition, (bulletposition - bulletlastposition))
- local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, {char, modelforparts} )
- if (torso.Position - rayPart.Position).magnitude > 840 then
- rayPart:Destroy()
- hitobj = true
- break
- end
- if hit then
- hitobj = true
- local damage = math.random(Dmg, Dmg+6)
- if hit.Parent:findFirstChild("Humanoid") ~= nil then
- hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage
- elseif hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") then
- hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage
- end
- local boom = Instance.new("Part", modelforparts)
- boom.BrickColor = rayPart.BrickColor
- boom.Anchored = true
- boom.FormFactor = "Custom"
- boom.Size = Vector3.new(1,1,1)
- boom.CanCollide = false
- boom.Transparency = 0.25
- boom.CFrame = CFrame.new(hitposition.x, hitposition.y, hitposition.z)
- boom.TopSurface = 0
- boom.BottomSurface = 0
- local sphere = Instance.new("SpecialMesh", boom)
- sphere.MeshType = "Sphere"
- local pl = Instance.new("PointLight", boom)
- pl.Color = Color3.new(boom.BrickColor.r/1.5, boom.BrickColor.g/1.5, boom.BrickColor.b/1.5)
- pl.Range = 20
- for ye = 0, 8 do
- local lite = Instance.new("Part", boom)
- lite.FormFactor = "Custom"
- lite.Size = Vector3.new(.2, 1.5, .2)
- lite.BrickColor = boom.BrickColor
- lite.CanCollide = false
- lite.TopSurface = 0
- lite.Anchored = false
- lite.BottomSurface = 0
- lite.Position = boom.Position + Vector3.new(math.random(-10, 10), math.random(6,15), math.random(-10, 10))
- end
- for i = 0, 20, 2.5 do
- sphere.Scale = sphere.Scale + Vector3.new(i,i,i)
- boom.Transparency = boom.Transparency + i/60
- pl.Range = pl.Range + i/15
- wait()
- end
- boom:Destroy()
- for i,v in pairs(workspace:children()) do
- if v:IsA("Model") and v:findFirstChild("Humanoid") then
- if v:findFirstChild("Head") and v:findFirstChild("Torso") then
- if (v:findFirstChild("Torso").Position - boom.Position).magnitude < 16 and v.Name ~= char.Name then
- v:findFirstChild("Humanoid"):TakeDamage(math.random(Dmg+2,Dmg+6))
- end
- end
- end
- if v and v:IsA("Part") and v.Name ~= "Base" then
- if (v.Position - boom.Position).magnitude < 16 then
- v:BreakJoints()
- v.TopSurface = 0
- v.BottomSurface = 0
- v.LeftSurface = 0
- v.RightSurface = 0
- v.FrontSurface = 0
- v.BackSurface = 0
- v.Anchored = false
- end
- end
- end
- pcall(function()
- bulletposition = hitposition
- rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0)
- rayPart:Destroy()
- end)
- break
- end
- rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0)
- rayPart.Parent = modelforparts
- end
- end))
- for i = 70, 65, -1.5 do
- firing = true
- camera.FieldOfView = i
- wait()
- end
- for i = 65, 70, 2.5 do
- firing = false
- camera.FieldOfView = i
- wait()
- end
- end)
- if err then
- print(err)
- end
- end
- end
- charge = 100
- plrgui = game:service'Players'.LocalPlayer:findFirstChild("PlayerGui")
- local statusgui = Instance.new("ScreenGui", plrgui)
- local mainframe = Instance.new("Frame", statusgui)
- mainframe.Size = UDim2.new(0, 200, 0, 200)
- mainframe.Position = UDim2.new(.75, 0, .75, 0)
- mainframe.Style = 3
- local image = Instance.new("ImageLabel", mainframe)
- image.Size = UDim2.new(1, 0, .47, 0)
- image.Position = UDim2.new(0, 0, .235, 0)
- image.BackgroundTransparency = 1
- image.Image = "rbxassetid://145057975"
- local chargetext = Instance.new("TextLabel", mainframe)
- chargetext.FontSize = "Size18"
- chargetext.Size = UDim2.new(1, 0, .95, 0)
- chargetext.TextYAlignment = "Bottom"
- chargetext.BackgroundTransparency = 1
- chargetext.TextColor3 = Color3.new(1,1,1)
- game:service'RunService'.Stepped:connect(function()
- chargetext.Text = math.floor(charge).."%"
- end)
- local rm = Instance.new("Weld", torso)
- rm.C0 = CFrame.new(1.5, 0.5, 0)
- rm.C1 = CFrame.new(0, 0.5, 0)
- rm.Part0 = torso
- rm.Part1 = ra
- local lm = Instance.new("Weld", torso)
- lm.C0 = CFrame.new(-1.5, 0.5, 0)
- lm.C1 = CFrame.new(0, 0.5, 0)
- lm.Part0 = torso
- lm.Part1 = la
- sound = Instance.new("Sound", head)
- sound.Volume = 1
- sound.SoundId = "rbxassetid://144834276"
- sound.Looped = true
- dancemode = true
- debounceofsprint = false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement