Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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")
- 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
- local Player = owner
- local Character = Player.Character
- --Mouse.TargetFilter = workspace
- local Head = Character:WaitForChild("Head")
- local Torso = Character:WaitForChild("Torso")
- local RootPart = Character:WaitForChild("HumanoidRootPart")
- local Human = Character:WaitForChild("Humanoid")
- Human.AutoRotate = false
- Human.JumpPower = 0
- Human.WalkSpeed = 12
- -----------------------------------------------------------------------------------------------------------------------
- for _, Item in next, Character:GetChildren() do
- if Item:IsA("CharacterAppearance") then
- Item:Destroy()
- end
- end
- local Pants = Character:FindFirstChild("Pants") or Instance.new("Pants")
- Pants.PantsTemplate = "rbxassetid://69232474"
- Pants.Name = "Pants"
- Pants.Parent = Character
- local Shirt = Character:FindFirstChild("Shirt") or Instance.new("Shirt")
- Shirt.ShirtTemplate = "rbxassetid://69232183"
- Shirt.Name = "Shirt"
- Shirt.Parent = Character
- local Face = Head:WaitForChild("face")
- Face.Texture = "rbxassetid://112805849"
- local TShirt = Torso:FindFirstChild("roblox")
- if TShirt then
- TShirt:Destroy()
- end
- --[[local BodyColors = Character:WaitForChild("Body Colors")
- BodyColors.HeadColor = BrickColor.new("Light orange")
- BodyColors.LeftArmColor = BrickColor.new("Light orange")
- BodyColors.RightArmColor = BrickColor.new("Light orange")
- BodyColors.TorsoColor = BrickColor.new("Light orange")--]]
- spawn(function() wait(.5)
- Head.BrickColor = BrickColor.new("Light orange")
- Torso.BrickColor = BrickColor.new("Light orange")
- Character["Left Arm"].BrickColor = BrickColor.new("Light orange")
- Character["Right Arm"].BrickColor = BrickColor.new("Light orange")
- end)
- Character:WaitForChild("Animate"):Destroy()
- local RJ = RootPart:WaitForChild("RootJoint")
- RJ:Destroy()
- RJ = Instance.new("Weld", RootPart)
- RJ.Part0 = RootPart
- RJ.Part1 = Torso
- local Neck = Instance.new("Weld", Torso)
- Neck.Part0 = Torso
- Neck.Part1 = Character:WaitForChild("Head")
- Neck.C0 = CFrame.new(0, 1.5, 0)
- Torso:WaitForChild("Right Shoulder").Part1 = nil
- local RS = Instance.new("Weld", Head)
- RS.Part0 = Head
- RS.Part1 = Character:WaitForChild("Right Arm")
- Torso:WaitForChild("Left Shoulder").Part1 = nil
- local LS = Instance.new("Weld", Head)
- LS.Part0 = Head
- LS.Part1 = Character:WaitForChild("Left Arm")
- local LH = Torso:WaitForChild("Left Hip")
- LH:Destroy()
- LH = Instance.new("Weld", Torso)
- LH.Part0 = Torso
- LH.Part1 = Character:WaitForChild("Left Leg")
- local RH = Torso:WaitForChild("Right Hip")
- RH:Destroy()
- RH = Instance.new("Weld", Torso)
- RH.Part0 = Torso
- RH.Part1 = Character:WaitForChild("Right Leg")
- local GUN = Instance.new("Part", Character)
- GUN.CanCollide = false
- GUN.Size = Vector3.new(1.549, 2.302, 3.814)
- GUN.Name = "Handle"
- GUN.Material = Enum.Material.SmoothPlastic
- local MS = Instance.new("SpecialMesh", GUN)
- MS.MeshType = Enum.MeshType.FileMesh
- MS.MeshId = "rbxassetid://450812185"
- MS.TextureId = "rbxassetid://450812194"
- local GRIP = Instance.new("Weld", RS.Part1)
- GRIP.Part0 = RS.Part1
- GRIP.Part1 = GUN
- local SN = Instance.new("Sound", GUN)
- SN.SoundId = "rbxassetid://341294387"
- SN.PlaybackSpeed = 0.9
- SN.Looped = true
- SN.Volume = 0
- SN:Play()
- local FL = Instance.new("Part", GUN)
- FL.BrickColor = BrickColor.Yellow()
- FL.Transparency = 1
- FL.Material = Enum.Material.SmoothPlastic
- FL.CanCollide = false
- FL.Size = Vector3.new(1, 3.38, 1)
- local MS2 = Instance.new("SpecialMesh", FL)
- MS2.MeshType = Enum.MeshType.FileMesh
- MS2.MeshId = "rbxassetid://1323306"
- MS2.Scale = Vector3.new(0.35, 1.9, 0.35)
- local FLW = Instance.new("Weld", GUN)
- FLW.Part0 = GUN
- FLW.Part1 = FL
- FLW.C0 = CFrame.new(0.293, 0.251, 3.221, 0, 0.028, 1, 1, 0, 0, 0, 1, -0.028)
- -----------------------------------------------------------------------------------------------------------------------
- local STANCE = {
- NK = CFrame.new(0, 1, 0, 0.747311652, 0, 0.664473772, 0, 1, 0, -0.664473772, 0, 0.747311652);
- RJ = CFrame.new(0, 0, 0, 0.747311592, 0, -0.664473712, 0, 1, 0, 0.664473712, 0, 0.747311592);
- LS = CFrame.new(0.474761963, -1.61745477, -1.20455933, -0.127145067, -0.88503027, -0.447834671, -0.836402416, 0.338357687, -0.431213528, 0.533165276, 0.319743276, -0.783262014);
- RS = CFrame.new(1.14480591, -1.47239065, 0.695491791, 0.972185493, -0.190045089, -0.136889026, 0.123703048, 0.912935674, -0.388903707, 0.198880106, 0.361152887, 0.911051929);
- GRIP = CFrame.new(-0.0976009369, -1.92251587, -1.31733322, -0.980839312, 0.117544398, -0.155363142, 0.158846945, 0.944226265, -0.288452089, 0.11279203, -0.307604104, -0.944805682);
- }
- LS.C0 = STANCE.LS
- RS.C0 = STANCE.RS
- RJ.C0 = STANCE.RJ
- GRIP.C0 = STANCE.GRIP
- local Down = false
- Mouse.Button1Down:Connect(function()
- Down = true
- end)
- Mouse.Button1Up:Connect(function()
- Down = false
- end)
- math.randomseed(os.time())
- local function Taunt()
- local Taunts = {137542750, 130774824, 130776108, 679798995, 679798810}
- local Sound = Instance.new("Sound", GUN)
- local Id = Taunts[math.random(#Taunts)]
- Sound.TimePosition = Id == 130776108 and 4.2 or 0
- Sound.SoundId = "rbxassetid://" .. Id
- Sound.Volume = 1
- Sound.Ended:Connect(function()
- Sound:Destroy()
- end)
- Sound:Play()
- end
- Mouse.KeyDown:Connect(function(Key)
- if Key == string.char(32) then
- Taunt()
- end
- end)
- local function Shoot()
- local Bullet = Instance.new("Part")
- Bullet.Size = Vector3.new(0.3, 0.3, 0.7)
- Bullet.Transparency = 1
- Bullet.CanCollide = false
- local AntiGravity = Instance.new("BodyForce", Bullet)
- AntiGravity.Force = Vector3.new(0, Bullet:GetMass() * workspace.Gravity, 0)
- local Start = (GUN.CFrame * CFrame.new(0.255, 0.251, 1.877)).p
- Bullet.CFrame = CFrame.new(Start, Mouse.Hit.p)
- Bullet.Velocity = Bullet.CFrame.lookVector * 300
- Bullet.Touched:Connect(function(Hit)
- if Hit.Parent and Hit.Parent ~= Character and Hit.Parent:FindFirstChild("Humanoid") then
- Hit.Parent.Humanoid:TakeDamage(5)
- Bullet:Destroy()
- end
- end)
- Bullet.Parent = workspace
- game.Debris:AddItem(Bullet, 3)
- end
- game:GetService("RunService"):BindToRenderStep("Invisible", Enum.RenderPriority.Character.Value - 1, function()
- GUN.LocalTransparencyModifier = 0
- FL.LocalTransparencyModifier = 0
- LS.Part1.LocalTransparencyModifier = 0
- RS.Part1.LocalTransparencyModifier = 0
- end)
- local Heartbeat, Angle = game:GetService("RunService").Heartbeat
- while Heartbeat:Wait() do
- local Angle = tick() * 8
- -- Torso lean
- local VelocityForTilt = RootPart.Velocity * Vector3.new(1, 0, 1) / 150
- local VectorForTilt = RootPart.CFrame:vectorToObjectSpace(VelocityForTilt)
- RJ.C0 = RJ.C0:Lerp(STANCE.RJ * CFrame.Angles(VectorForTilt.Z, VectorForTilt.X, -VectorForTilt.X), 0.1)
- -- Rotate to face camera
- local RootPosition = RootPart.Position
- local Direction = Mouse.Hit.p - RootPosition
- Direction = Vector3.new(Direction.X, 0, Direction.Z).unit
- local NewCFrame = CFrame.new(RootPosition, RootPosition + Direction) * CFrame.Angles(0, -0.02, 0)
- RootPart.CFrame = RootPart.CFrame:Lerp(NewCFrame, 0.1)
- -- Neck Angle
- local Hypotenuse = (Mouse.Hit.p - Head.Position).magnitude
- local Opposite = Mouse.Hit.p.y - Head.Position.y
- local Pitch = math.asin(Opposite / Hypotenuse)
- local NewNeckCFrame = STANCE.NK * CFrame.Angles(Pitch + 0.2, 0, 0) * CFrame.new(0, 0.5, 0)
- Neck.C0 = Neck.C0:Lerp(NewNeckCFrame, 0.1)
- -- Legs
- local FlatVelocity = (Torso.Velocity * Vector3.new(1, 0, 1))
- if FlatVelocity.magnitude < 2 then
- LH.C0 = LH.C0:Lerp(CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.sin(tick() * 0.5) / 17, 0, -0.02 + math.sin(tick() * 0.4) / 19) * CFrame.new(0, -1, 0), 0.2)
- RH.C0 = RH.C0:Lerp(CFrame.new(0.5, -1, 0) * CFrame.Angles(math.sin(-tick() * 0.5) / 18, 0, 0.02 + math.sin(-tick() * 0.35) / 20) * CFrame.new(0, -1, 0), 0.2)
- else
- local Look = (Torso.CFrame.lookVector * Vector3.new(1, 0, 1)).unit
- local Move = FlatVelocity.unit
- local OffAngle = (Look:Cross(Move).Y > 0 and 1 or -1) * math.acos(1 - (Look - Move).magnitude ^ 2 / 2)
- OffAngle = math.max(-math.pi, math.min(math.pi, OffAngle))
- LH.C0 = LH.C0:Lerp(CFrame.new(-0.5, 0, 0) * CFrame.Angles(0, OffAngle, 0)
- * CFrame.new(0, -math.max(0, math.cos(Angle * 2) / 5) + math.max(0, math.cos(Angle + math.pi) / 2.5) - 2, math.sin(-Angle + math.pi) / 1.8 + 0.15)
- * CFrame.Angles(math.sin(-Angle) / 1.8 - 0.2, 0, 0), 0.2)
- RH.C0 = RH.C0:Lerp(CFrame.new(0.5, 0, 0) * CFrame.Angles(0, OffAngle, 0)
- * CFrame.new(0, -math.max(0, math.cos(Angle * 2) / 5) + math.max(0, math.cos(Angle) / 2.5) - 2, math.sin(-Angle) / 1.8 + 0.15)
- * CFrame.Angles(math.sin(Angle) / 1.8 - 0.2, 0, 0), 0.2)
- end
- -- Shooting
- if Down then
- SN.Volume = SN.Volume + (1.5 - SN.Volume) * 0.3
- FL.Transparency = FL.Transparency + (0.6 - FL.Transparency) * 0.2
- FLW.C0 = FLW.C0 * CFrame.Angles(0, 0.2, 0)
- Shoot()
- else
- SN.Volume = SN.Volume + (0 - SN.Volume) * 0.15
- FL.Transparency = FL.Transparency + (1 - FL.Transparency) * 0.2
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement