Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This script has been converted to FE by iPxter
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,Mouse,mouse,UserInputService,ContextActionService = owner
- do
- print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
- script.Parent = Player.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent and t.Function then
- t.Function(...)
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=Player then return end
- if io.isMouse then
- m.Target = io.Target
- m.Hit = io.Hit
- else
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local Mouse = Player:GetMouse()
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
- end
- --[[
- Objects Skipped: 1
- UnionOperation: 1
- --]]
- player = owner
- character = owner.Character
- function CreateObject(b,c)local d=Instance.new(b)
- for e,f in pairs(c)do d[f[1]]=f[2]end;return d end
- gold=CreateObject("Tool",{{"TextureId","rbxassetid://2530942954"},{"Name","gold"},{"ToolTip","YEETUS"},{"Parent",player.Backpack}})
- FakeHandle=CreateObject("Part",{{"CanCollide",false},{"Shape",2},{"Size",Vector3.new(0.29,0.25,0.48)},{"BottomSurface",0},{"Orientation",Vector3.new(0,
- -90,0)},{"Material",1568},{"Name","FakeHandle"},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -88.065,0.215,195.145)*CFrame.Angles(0,-1.571,0)}})
- fire=CreateObject("Sound",{{"PlaybackSpeed",0.7},{"Name","Fire"},{"SoundId","rbxassetid://1590181673"},{"Parent",FakeHandle}})
- reload=CreateObject("Sound",{{"PlaybackSpeed",0.7},{"Name","Reload"},{"SoundId","rbxassetid://138084889"},{"Parent",FakeHandle}})
- pointlight=CreateObject("PointLight",{{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Range",6},{"Parent",FakeHandle}})
- part=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(0.36,0.05,0.28)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -88.06,0.195,195.14)}})
- part_2=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(1.3,0.14,0.73)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -87.07,0.23,197.005)}})
- part_3=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(0.23,0.14,0.06)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -87.605,0.23,196.18)}})
- part_4=CreateObject("Part",{{"CanCollide",false},{"Shape",2},{"Size",Vector3.new(1.1,0.18,0.23)},{"Orientation",Vector3.new(0,
- -90,0)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -88.06,0.21,195.77)*CFrame.Angles(0,-1.571,0)}})
- part_5=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(0.13,0.1,0.52)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -87.905,0.23,196.12)}})
- part_6=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(0.46,0.14,1.09)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -87.95,0.23,196.865)}})
- part_7=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(0.46,0.14,0.1)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(24)},{"TopSurface",0},{"Color",Color3.new(0.960784,0.803922,0.188235)},{"Parent",gold},{"CFrame",CFrame.new(
- -87.95,0.23,197.46)*CFrame.Angles(0,0,0)}})
- part_8=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(0.24,0.14,0.06)},{"Orientation",Vector3.new(0,31.41,0)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -87.398,0.23,196.124)*CFrame.Angles(0,0.548,0)}})
- part_9=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(0.13,0.1,0.42)},{"Material",1568},{"BottomSurface",0},{"BrickColor",BrickColor.new(333)},{"TopSurface",0},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"Parent",gold},{"CFrame",CFrame.new(
- -87.775,0.23,196.17)}})
- handle=CreateObject("Part",{{"CanCollide",false},{"Size",Vector3.new(1.3,0.14,0.73)},{"BottomSurface",0},{"Orientation",Vector3.new(0,0,90.29)},{"Material",1568},{"Name","Handle"},{"Transparency",1},{"BrickColor",BrickColor.new(333)},{"Color",Color3.new(0.937255,0.721569,0.219608)},{"TopSurface",0},{"Parent",gold},{"CFrame",CFrame.new(
- -87.07,0.23,197.005)*CFrame.Angles(0,0,1.576)}})
- --functions lol fuck
- local H = gold:GetChildren()
- for i = 1, #H do
- local P0 = gold.Handle
- local P = H[i]
- if P.ClassName == "Part" then
- local W = Instance.new("Weld")
- W.Part0 = P0
- W.Part1 = P
- W.C0 = P0.CFrame:inverse()
- W.C1 = P.CFrame:inverse()
- W.Parent = script.Parent
- W.Name = "UEWeld"
- end
- end
- local Can = true
- function oe(m)
- if Can == false then return end
- Can = false
- local H = gold:GetChildren()
- for i = 1, #H do
- local P0 = gold.Handle
- local P = H[i]
- if P.Name ~= "Bullet" then
- if P.ClassName == "Part" then
- local W = Instance.new("Weld")
- W.Part0 = P0
- W.Part1 = P
- W.C0 = P0.CFrame:inverse()
- W.C1 = P.CFrame:inverse()
- W.Parent = script.Parent
- W.Name = "EWeld"
- end
- local H = script.Parent:GetChildren()
- for i = 1, #H do
- if P.ClassName == "Weld" and P.Name == "UEWeld" then P:Destroy() end
- if P.ClassName == "Part" then P.Anchored = false end
- end
- Can = true
- end
- end
- end
- gold.Equipped:connect(oe)
- function oe()
- if Can == false then return end
- Can = false
- local H = gold:GetChildren()
- for i = 1, #H do
- local P0 = gold.Handle
- local P = H[i]
- if P.Name ~= "Bullet" then
- if P.ClassName == "Part" then
- local W = Instance.new("Weld")
- W.Part0 = P0
- W.Part1 = P
- W.C0 = P0.CFrame:inverse()
- W.C1 = P.CFrame:inverse()
- W.Parent = script.Parent
- W.Name = "UEWeld"
- end
- for i = 1, #H do
- if P.ClassName == "Weld" and P.Name == "EWeld" then P:Destroy() end
- if P.ClassName == "Part" then P.Anchored = true end
- end
- Can = true
- end
- end
- end
- gold.Unequipped:connect(oe)
- local Tool = gold;
- enabled = true
- function onButton1Down(mouse)
- if not enabled then
- return
- end
- enabled = false
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- wait(.5)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- enabled = true
- end
- function onEquippedLocal(mouse)
- if mouse == nil then
- print("Mouse not found")
- return
- end
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- local g = gold:GetChildren()
- for i=1, #g do
- if g[i].className == "Part" then
- g[i].CanCollide = false
- end
- end
- end
- Tool.Equipped:connect(onEquippedLocal)
- function onUnequippedLocal(mouse)
- local g = gold:GetChildren()
- for i=1, #g do
- if g[i].className == "Part" then
- g[i].CanCollide = true
- end
- end
- end
- Tool.Unequipped:connect(onUnequippedLocal)
- -----------------
- --| Constants |--
- -----------------
- local SHOT_SPEED = 100
- local SHOT_TIME = 1
- local NOZZLE_OFFSET = Vector3.new(0, 0.4, -1.1)
- -----------------
- --| Variables |--
- -----------------
- local PlayersService = Game:GetService('Players')
- local DebrisService = Game:GetService('Debris')
- local Tool = gold
- local Handle = Tool:WaitForChild('Handle')
- local FireSound = Handle:WaitForChild('Fire')
- local ReloadSound = Handle:WaitForChild('Reload')
- --local HitFadeSound = Handle:WaitForChild('HitFade')
- local PointLight = Handle:WaitForChild('PointLight')
- local Character = nil
- local Humanoid = nil
- local Player = nil
- local BaseShot = nil
- -----------------
- --| Functions |--
- -----------------
- -- Returns a character ancestor and its Humanoid, or nil
- local function FindCharacterAncestor(subject)
- if subject and subject ~= Workspace then
- local humanoid = subject:FindFirstChild('Humanoid')
- if humanoid then
- return subject, humanoid
- else
- return FindCharacterAncestor(subject.Parent)
- end
- end
- return nil
- end
- -- Removes any old creator tags and applies new ones to the specified target
- local function ApplyTags(target)
- while target:FindFirstChild('creator') do
- target.creator:Destroy()
- end
- local creatorTag = Instance.new('ObjectValue')
- creatorTag.Value = Player
- creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
- local iconTag = Instance.new('StringValue')
- iconTag.Value = Tool.TextureId
- iconTag.Name = 'icon'
- iconTag.Parent = creatorTag
- creatorTag.Parent = target
- DebrisService:AddItem(creatorTag, 4)
- end
- -- Returns all objects under instance with Transparency
- local function GetTransparentsRecursive(instance, partsTable)
- local partsTable = partsTable or {}
- for _, child in pairs(instance:GetChildren()) do
- if child:IsA('BasePart') or child:IsA('Decal') then
- table.insert(partsTable, child)
- end
- GetTransparentsRecursive(child, partsTable)
- end
- return partsTable
- end
- local function SelectionBoxify(instance)
- local selectionBox = Instance.new('SelectionBox')
- selectionBox.Adornee = instance
- selectionBox.Color = BrickColor.new('Gold')
- selectionBox.Parent = instance
- return selectionBox
- end
- local function Light(instance)
- local light = PointLight:Clone()
- light.Range = light.Range + 2
- light.Parent = instance
- end
- local function FadeOutObjects(objectsWithTransparency, fadeIncrement)
- repeat
- local lastObject = nil
- for _, object in pairs(objectsWithTransparency) do
- object.Transparency = object.Transparency + fadeIncrement
- lastObject = object
- end
- wait()
- until lastObject.Transparency >= 1 or not lastObject
- end
- local function Dematerialize(character, humanoid, firstPart)
- humanoid.WalkSpeed = 0
- local parts = {}
- for _, child in pairs(character:GetChildren()) do
- if child:IsA('BasePart') then
- child.Anchored = true
- table.insert(parts, child)
- elseif child:IsA('LocalScript') or child:IsA('Script') then
- child:Destroy()
- end
- end
- local selectionBoxes = {}
- local firstSelectionBox = SelectionBoxify(firstPart)
- Light(firstPart)
- wait(0.05)
- for _, part in pairs(parts) do
- if part ~= firstPart then
- table.insert(selectionBoxes, SelectionBoxify(part))
- Light(part)
- end
- end
- local objectsWithTransparency = GetTransparentsRecursive(character)
- FadeOutObjects(objectsWithTransparency, 0.1)
- wait(0.5)
- humanoid.Health = 0
- DebrisService:AddItem(character, 2)
- local fadeIncrement = 0.05
- Delay(0.2, function()
- FadeOutObjects({firstSelectionBox}, fadeIncrement)
- if character then
- character:Destroy()
- end
- end)
- FadeOutObjects(selectionBoxes, fadeIncrement)
- end
- local function OnTouched(shot, otherPart)
- local character, humanoid = FindCharacterAncestor(otherPart)
- if character and humanoid and character ~= Character then
- ApplyTags(humanoid)
- if shot then
- --local hitFadeSound = shot:FindFirstChild(HitFadeSound.Name)
- --if hitFadeSound then
- --hitFadeSound.Parent = humanoid.Torso
- --hitFadeSound:Play()
- end
- shot:Destroy()
- end
- Dematerialize(character, humanoid, otherPart)
- end
- local function OnEquipped()
- Character = Tool.Parent
- Humanoid = Character:WaitForChild('Humanoid')
- Player = PlayersService:GetPlayerFromCharacter(Character)
- plr = owner
- hum = plr.Character.HumanoidRootPart
- mouse.KeyDown:connect(function(key)
- if key == "q" then
- if mouse.Target then
- hum.CFrame = CFrame.new(mouse.Hit.x, mouse.Hit.y + 5, mouse.Hit.z)
- end
- end
- end)
- end
- local function OnActivated()
- if Tool.Enabled and Humanoid.Health > 0 then
- Tool.Enabled = false
- FireSound:Play()
- local handleCFrame = Handle.CFrame
- local firingPoint = handleCFrame.p + handleCFrame:vectorToWorldSpace(NOZZLE_OFFSET)
- local shotCFrame = CFrame.new(firingPoint, Humanoid.TargetPoint)
- local laserShotClone = BaseShot:Clone()
- laserShotClone.CFrame = shotCFrame + (shotCFrame.lookVector * (BaseShot.Size.Z / 2))
- local bodyVelocity = Instance.new('BodyVelocity')
- bodyVelocity.velocity = shotCFrame.lookVector * SHOT_SPEED
- bodyVelocity.Parent = laserShotClone
- laserShotClone.Touched:connect(function(otherPart)
- OnTouched(laserShotClone, otherPart)
- end)
- DebrisService:AddItem(laserShotClone, SHOT_TIME)
- laserShotClone.Parent = Tool
- wait(0.6) -- FireSound length
- ReloadSound:Play()
- wait(0.75) -- ReloadSound length
- Tool.Enabled = true
- end
- end
- local function OnUnequipped()
- end
- --------------------
- --| Script Logic |--
- --------------------
- BaseShot = Instance.new('Part')
- BaseShot.Name = 'Effect'
- BaseShot.FormFactor = Enum.FormFactor.Custom
- BaseShot.Size = Vector3.new(0.2, 0.2, 3)
- BaseShot.CanCollide = false
- BaseShot.BrickColor = BrickColor.new('Gold')
- SelectionBoxify(BaseShot)
- Light(BaseShot)
- HitFadeSound:Clone().Parent = BaseShot
- Tool.Equipped:connect(OnEquipped)
- Tool.Unequipped:connect(OnUnequipped)
- Tool.Activated:connect(OnActivated)
- function killer()
- if Mouse.Target.Parent ~= char and Mouse.Target.Parent.Parent ~= char and Mouse.Target.Parent:FindFirstChildOfClass("Humanoid") ~= nil then
- FireSound:Play()
- Mouse.Target.Parent:BreakJoints()
- wait(1)
- ReloadSound:Play()
- end
- end
- ----------------------------------
- Mouse.KeyDown:connect(function(key)
- if key == 'v' then
- killer()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement