Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tool = Instance.new("Tool")
- Tool.Name = "Gun"
- Gun = Instance.new("Part")
- Gun.Name = "Handle"
- Gun.Parent = Tool
- Tool.Parent = workspace.Lucas_YT111
- Gun.Size = Vector3.new(0.147, 0.845, 1.401)
- Gun.Massless = true
- Gun.CanCollide = false
- local Pow = Instance.new("Sound", owner.character.Head)
- Pow.SoundId = "rbxassetid://1202656211"
- Pow.Volume = 1
- active = false
- Mesh = Instance.new("SpecialMesh")
- Mesh.Parent = Gun
- Mesh.MeshId = "http://www.roblox.com/asset/?id=3732772227"
- Mesh.TextureId = "http://www.roblox.com/asset/?id=3732772286"
- Mesh.Scale = Vector3.new(2, 2, 2)
- Tool.Activated:connect(function()
- active = true
- Pow:Play()
- wait()
- active = false
- end)
- local Root = Gun
- local function onCreateLASERR(player, Location)
- if active then
- local rng = Random.new()
- local LASERR = Instance.new("Part")
- LASERR.Name = "LASERR"
- LASERR.TopSurface = Enum.SurfaceType.Smooth
- LASERR.BottomSurface = Enum.SurfaceType.Smooth
- LASERR.Size = Vector3.new(1, 1, 2.5)
- LASERR.BrickColor = BrickColor.new("Electric blue")
- LASERR.Material = Enum.Material.Neon
- LASERR.Anchored = true
- LASERR.CanCollide = false
- LASERR.Locked = true
- LASERR.CFrame = Root.CFrame
- LASERR.Parent = workspace
- local maxDistance = 200
- local curDistance = 0
- local stepDistance = 4
- local stepWait = 0
- local currentPos = Root.Position
- local currentNormal = CFrame.new(Root.CFrame.p, Location).lookVector
- local function Step(overrideDistance)
- local params = RaycastParams.new()
- local direction = currentNormal * (overrideDistance or stepDistance)
- params.FilterType = Enum.RaycastFilterType.Blacklist
- params.FilterDescendantsInstances = {script.Parent.Parent}
- local result = workspace:Raycast(currentPos, direction)
- local pos
- if result then
- pos = result.Position
- else
- pos = currentPos + direction
- end
- LASERR.Size = Vector3.new(1, 1, (pos - currentPos).Magnitude)
- LASERR.CFrame = CFrame.new(currentPos:Lerp(pos, 0.5), pos)
- local oldPos = currentPos
- currentPos = pos
- if result then
- local norm = result.Normal
- local reflect = (currentNormal - (2 * currentNormal:Dot(norm) * norm))
- currentNormal = reflect
- Step(stepDistance - (pos - oldPos).Magnitude)
- return
- end
- curDistance = (curDistance + (pos - oldPos).Magnitude)
- if curDistance > (maxDistance - 500) then
- local d = (curDistance - (maxDistance - 500)) / 500
- LASERR.Transparency = d
- end
- if curDistance < maxDistance then
- wait(stepWait)
- Step()
- end
- end
- LASERR.Touched:connect(function(hit)
- if hit.Parent.Name ~= owner.Character.Name then
- local humanoid = hit.Parent:FindFirstChild("Humanoid")
- if humanoid then
- humanoid:TakeDamage(30)
- LASERR:Destroy()
- end
- end
- end)
- Step()
- end
- end
- local E = Instance.new("RemoteEvent",NLS([[local E = script:FindFirstChildWhichIsA("RemoteEvent")
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- mouse.Button1Down:Connect(function()
- local Location = mouse.Hit.p
- E:FireServer(Location)
- end)
- ]],owner.PlayerGui))
- E.OnServerEvent:Connect(onCreateLASERR)
- Tool.GripPos = Vector3.new(0,0,0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement