Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Players = game:GetService("Players")
- LocalPlayer = Players.LocalPlayer
- Backpack = LocalPlayer.Backpack
- StarterGui = game:GetService("StarterGui")
- local Flashlight = Instance.new("Tool", Backpack)
- Flashlight.GripPos = Vector3.new(0.1, -0.4, 0)
- Flashlight.Name = "Flashlight"
- Flashlight.TextureId = "http://www.roblox.com/asset/?id=115955232"
- local Handle = Instance.new("Part", Flashlight)
- Handle.BrickColor = BrickColor.new("Bright yellow")
- Handle.Color = Color3.fromRGB(245, 205, 48)
- Handle.Name = "Handle"
- Handle.Locked = true
- Handle.Size = Vector3.new(0.5, 0.5, 2)
- Handle.CanCollide = true
- local LightPart = Instance.new("Part", Flashlight)
- LightPart.BrickColor = BrickColor.new("Mid gray")
- LightPart.Color = Color3.fromRGB(205, 205, 205)
- LightPart.Transparency = 1
- LightPart.Name = "LightPart"
- LightPart.CanCollide = false
- LightPart.Locked = true
- LightPart.Size = Vector3.new(0.2, 0.2, 0.2)
- local Motor = Instance.new("Motor", Flashlight)
- Motor.Part0 = Handle
- Motor.Part1 = LightPart
- local Sound = Instance.new("Sound", Handle)
- Sound.SoundId = "http://www.roblox.com/asset/?id=115959318"
- Sound.Volume = 1
- local Mesh = Instance.new("SpecialMesh", Handle)
- Mesh.Name = "Mesh"
- Mesh.MeshId = "http://www.roblox.com/asset/?id=115955313"
- Mesh.MeshType = "FileMesh"
- Mesh.Scale = Vector3.new(0.7, 0.7, 0.7)
- Mesh.TextureId = "http://www.roblox.com/asset?id=115955343"
- local SpotLight = Instance.new("SpotLight", LightPart)
- SpotLight.Name = "SpotLight"
- SpotLight.Angle = 70
- SpotLight.Color = Color3.fromRGB(244, 255, 233)
- SpotLight.Enabled = false
- SpotLight.Face = "Front"
- SpotLight.Range = 32
- local SpotLight2 = Instance.new("SpotLight", LightPart)
- SpotLight2.Name = "SpotLight2"
- SpotLight2.Angle = 70
- SpotLight2.Brightness = .75
- SpotLight2.Color = Color3.fromRGB(244, 255, 233)
- SpotLight2.Enabled = false
- SpotLight2.Range = 60
- sp = Flashlight
- cooldown = .35
- lightontexture = 115984370
- lightofftexture = 115955343
- local weld = sp:WaitForChild("Motor")
- local lp = sp:WaitForChild("LightPart")
- local handle = sp:WaitForChild("Handle")
- local spotlight = lp:WaitForChild("SpotLight")
- local spotlight2 = lp:WaitForChild("SpotLight2")
- local mesh = handle:WaitForChild("Mesh")
- local sound = handle:WaitForChild("Sound")
- lastclick = 0
- sp.Equipped:connect(
- function(mouse)
- equipped = true
- if mouse ~= nil then
- themouse = mouse
- mouse.Button1Down:connect(
- function()
- if lastclick + cooldown < tick() then
- spotlight.Enabled = not spotlight.Enabled
- spotlight2.Enabled = spotlight.Enabled
- mesh.TextureId =
- "http://www.roblox.com/asset?id=" ..
- tostring((spotlight.Enabled and lightontexture) or lightofftexture)
- sound:Play()
- lastclick = tick()
- end
- end
- )
- end
- if weld ~= nil then
- weld.Parent = sp
- end
- while equipped and sp.Parent ~= nil do
- local head = sp.Parent:FindFirstChild("Head")
- if spotlight.Enabled and themouse and handle and weld and head then
- local vec = themouse.Hit.p - head.Position
- local pos = (handle.CFrame * CFrame.new(0, 0, -1)).p
- local cf = CFrame.new(pos, pos + vec)
- --lp.CFrame=cf
- weld.C0 = handle.CFrame:toObjectSpace(cf)
- end
- wait()
- end
- end
- )
- sp.Unequipped:connect(
- function()
- if weld ~= nil then
- weld.Parent = sp
- end
- equipped = false
- end
- )
- local Flashlight2 = Flashlight:clone()
- Flashlight2.Parent = StarterGui
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement