Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tool=Instance.new("Tool",game.Players.LocalPlayer.Backpack)
- tool.GripForward = Vector3.new(0, 0, -1)
- tool.GripPos = Vector3.new(0, -0.1, 0.75)
- tool.GripRight = Vector3.new(1, 0, 0)
- tool.GripUp = Vector3.new(0,1,0)
- tool.TextureId = "http://www.roblox.com/asset?id=130093050"
- tool.Name = "Ray Gun"
- local color = "Red"
- local handle=Instance.new("Part",tool)
- handle.Name="Handle"
- handle.Size=Vector3.new(1,1,1)
- handle.BrickColor = BrickColor.new(color)
- handle.Locked = true
- local mesh=Instance.new("SpecialMesh", handle)
- mesh.MeshType="FileMesh"
- mesh.MeshId="http://www.roblox.com/asset?id=130099641"
- mesh.Scale = Vector3.new(0.65, 0.65, 0.65)
- local user
- mode = 1
- tool.Equipped:connect(function(mouse)
- user = tool.Parent
- mouse.KeyDown:connect(function(k)
- if k == "q" then
- if mode == 1 then
- mode = 2
- color = "Lime green"
- handle.BrickColor = BrickColor.new(color)
- elseif mode == 2 then
- mode = 3
- color = "Really blue"
- handle.BrickColor = BrickColor.new(color)
- elseif mode == 3 then
- mode = 4
- color = "Bright pink"
- handle.BrickColor = BrickColor.new(color)
- elseif mode == 4 then
- color = "Teal"
- handle.BrickColor = BrickColor.new(color)
- mode = 1
- end
- elseif k == "z" then
- tool.GripUp = Vector3.new(tool.GripUp.x,tool.GripUp.y - 1 ,tool.GripUp.z)
- elseif k == "x" then
- tool.GripUp = Vector3.new(tool.GripUp.x,tool.GripUp.y + 1 ,tool.GripUp.z)
- end
- end)
- mouse.Button1Down:connect(function()
- local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300)
- local hit, position = game.Workspace:FindPartOnRay(ray, user)
- local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")
- if mode == 1 then
- if humanoid then
- humanoid:TakeDamage(100)
- end
- elseif mode == 2 then
- if humanoid then
- humanoid:TakeDamage(-10)
- end
- elseif mode == 3 then
- if humanoid then
- humanoid.WalkSpeed = 0
- humanoid.Parent.Torso.Transparency = 1
- humanoid.Parent.Head.Reflectance = 1
- humanoid.Parent.Head.Anchored = true
- humanoid.Parent.Animate.Disabled = true
- wait(0.5)
- humanoid.Parent:BreakJoints()
- humanoid.Parent.Torso.Transparency = 0
- humanoid.Parent.Head.Reflectance = 0
- humanoid.Parent.Head.Anchored = false
- humanoid.Parent.Animate.Disabled = false
- end
- elseif mode == 4 then
- if humanoid then
- local plr = game.Players:GetPlayerFromCharacter(humanoid.Parent)
- if plr then
- plr:remove()
- end
- end
- end
- local distance = (position - tool.Handle.CFrame.p).magnitude
- local rayPart = Instance.new("Part", user)
- rayPart.Name = "RayPart"
- rayPart.BrickColor = BrickColor.new(color)
- rayPart.Transparency = 0.6
- rayPart.Anchored = true
- rayPart.CanCollide = false
- rayPart.TopSurface = Enum.SurfaceType.Smooth
- rayPart.BottomSurface = Enum.SurfaceType.Smooth
- rayPart.formFactor = Enum.FormFactor.Custom
- rayPart.Size = Vector3.new(0.3, 0.3, distance)
- rayPart.CFrame = CFrame.new(position, tool.Handle.CFrame.p) * CFrame.new(0, 0, -distance/2)
- game.Debris:AddItem(rayPart, 0.1)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement