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,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- 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 TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- 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
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled 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,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true 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
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- local plr = owner
- local mouse = plr:GetMouse()
- plr:ClearCharacterAppearance()
- local char = plr.Character
- local attack = false
- local hum = char.Humanoid
- local RS = char.Torso["Right Shoulder"]
- local LS = char.Torso["Left Shoulder"]
- local RH = char.Torso["Right Hip"]
- local LH = char.Torso["Left Hip"]
- local neck = char.Torso["Neck"]
- local anim = char.Animate
- local rootj = char.HumanoidRootPart.RootJoint
- local timepos = 0
- local sine = 0
- local RSnor = RS.C0
- local LSnor = LS.C0
- local RHnor = RH.C0
- local LHnor = LH.C0
- local rootjnor = rootj.C0
- local necknor = neck.C0
- local hed = char.Head
- hats = Instance.new("Model",char)
- hats2 = Instance.new("Model",hats)
- NewSound = function(p, id, pit, vol, loop)
- local Sound = Instance.new("Sound",p)
- Sound.Pitch = pit
- Sound.Volume = vol
- Sound.SoundId = "rbxassetid://" ..id
- Sound.Looped = loop
- Sound:Play()
- return Sound
- end
- NewInstance = function(instance,parent,properties)
- local inst = Instance.new(instance)
- inst.Parent = parent
- if(properties)then
- for i,v in next, properties do
- pcall(function() inst[i] = v end)
- end
- end
- return inst;
- end
- ezweld = function(p, a, b, cf)
- local weld = Instance.new("Weld",p)
- weld.Part0 = a
- weld.Part1 = b
- weld.C0 = cf
- return weld
- end
- cam = workspace.CurrentCamera
- CF = CFrame.new
- angles = CFrame.Angles
- attack = false
- Euler = CFrame.fromEulerAnglesXYZ
- Rad = math.rad
- IT = Instance.new
- BrickC = BrickColor.new
- Cos = math.cos
- Acos = math.acos
- Sin = math.sin
- Asin = math.asin
- Abs = math.abs
- Mrandom = math.random
- Floor = math.floor
- Animation_Speed = 1 / 60
- ammo = 20
- bighead = Instance.new("Part",hats2)
- bighead.CanCollide = false
- bighead.Size = Vector3.new(0.1, 0.1, 0.1)
- bighead.Name = "OofHead"
- bigmesh = Instance.new("SpecialMesh",bighead)
- bigmesh.MeshId = "rbxassetid://1047997"
- bigmesh.TextureId = "rbxassetid://606673948"
- --bigweld = ezweld(char, bighead, hed, CFrame.new(0, -0.45, 0))
- bomb = Instance.new("Part",hats2)
- bomb.CanCollide = false
- bomb.Size = Vector3.new(0.1, 0.1, 0.1)
- bomb.Name = "Bom"
- bombmesh = Instance.new("SpecialMesh",bomb)
- bombmesh.MeshId = "rbxasset://fonts/timebomb.mesh"
- bombmesh.TextureId = "rbxasset://textures/bombtex.png"
- bombmesh.Scale = Vector3.new(0.8, 0.8, 0.8)
- bombweld = ezweld(char, bomb, bighead, CFrame.new(0, 0, 0) * CFrame.Angles(77, 77, 0))
- local Hats = bighead
- local HatsWeld = IT("Weld")
- HatsWeld.Parent = hed
- HatsWeld.Part0 = hed
- HatsWeld.Part1 = Hats
- HatsWeld.C0 = CF(0, 0.4, -0.1) * angles(Rad(0), Rad(0), Rad(0))
- print(owner.Character.Animate.toolnone.ToolNoneAnim.AnimationId)
- char.Humanoid.WalkSpeed = 0
- char.Humanoid.Jump = false
- char.Animate.idle.Animation1.AnimationId = "rbxassetid://182393478"
- local holdanim = hum:LoadAnimation(char.Animate.idle.Animation1)
- holdanim:Play()
- char.Animate.idle.Animation2.AnimationId = "rbxassetid://182393478"
- --wait(0.25)
- NLS([[
- while wait() do
- owner.Character["Right Arm"].LocalTransparencyModifier = 0
- --owner.Character["Left Arm"].LocalTransparencyModifier = 0
- --owner.Character["Right Leg"].LocalTransparencyModifier = 0
- --owner.Character["Left Leg"].LocalTransparencyModifier = 0
- --owner.Character["Torso"].LocalTransparencyModifier = 1
- end
- ]],char)
- char.Animate:Destroy()
- hum.WalkSpeed = 16
- pequip = false
- doarm = false
- psize = 0.05
- aheh = Instance.new("Model",char)
- aheh.Name = "Weapons"
- pistol = Instance.new("Part",workspace)
- pistol.Transparency = 1
- pistol.CanCollide = true
- pistol.Size = Vector3.new(0.1, 0.1, 0.1)
- pistol.Name = "Pistol"
- pmesh = Instance.new("SpecialMesh",pistol)
- pmesh.MeshId = "rbxassetid://468351345"
- pmesh.TextureId = "rbxassetid://468351348"
- pmesh.Scale = Vector3.new(psize, psize, psize)
- pwld = ezweld(char, pistol, char["Right Arm"],CFrame.new(-1.25, -0.5, 0) * CFrame.Angles(77, 0, 77))
- function poostal()
- if pequip then
- doarm = false
- pequip = false
- pistol.Transparency = 1
- else
- doarm = true
- pequip = true
- pistol.Transparency = 0
- end
- end
- function crit(part)
- local sur = Instance.new("BillboardGui", part)
- sur.Name = "Billboard"
- sur.Adornee = part
- sur.Size = UDim2.new(10, 0, 5, 0)
- sur.StudsOffset = Vector3.new(0, 5, 0)
- local text = Instance.new("TextLabel", sur)
- text.Text = "CRITICAL!"
- text.Size = UDim2.new(1, 0, 1, 0)
- text.TextScaled = true
- text.BackgroundTransparency = 1
- text.Font = Enum.Font.SourceSansLight
- text.TextColor3 = Color3.new(1, 0, 0)
- text.TextStrokeTransparency = 0
- game.Debris:AddItem(sur, 5)
- end
- function MouseDown(Key)
- if pequip and mouse.Target then
- local target = mouse.Target
- NewSound(hed, 2314169572, 1, 0.5, false)
- for _,v in pairs (target.Parent:GetChildren()) do
- if v:IsA("Humanoid") then
- v.Health = v.Health - 15
- end
- end
- if target.Name == "Head" then
- target:BreakJoints()
- print("CRITICAL!")
- crit(target)
- end
- end
- end
- function KeyDown(Key)
- if Key == "p" then
- poostal()
- end
- end
- mouse.KeyDown:connect(function(NEWKEY)
- KeyDown(NEWKEY)
- end)
- mouse.Button1Down:connect(function(NEWKEY)
- MouseDown(NEWKEY)
- end)
- while true do
- wait()
- sine = sine + 1
- spd = hum.WalkSpeed - 15 + 0.15
- spd2 = hum.WalkSpeed - 15 + 3
- speedval = 6 / (hum.WalkSpeed / 16)
- wld = char.Torso['Right Shoulder']
- tframe = char.Torso.CFrame
- local taim = mouse.Hit.p -( tframe.p )
- if attack == false and doarm == true then
- wld.C0 = (CFrame.new(Vector3.new(),tframe:vectorToObjectSpace(taim))*CFrame.Angles(0,math.pi/2,0))+Vector3.new( 1, 0.5, 0 ),1 / Animation_Speed
- end
- if(not char:FindFirstChildOfClass'Shirt')then
- NewInstance("Shirt",char,{ShirtTemplate='rbxassetid://131666081'})
- else
- char:FindFirstChildOfClass'Shirt'.ShirtTemplate='rbxassetid://131666081'
- end
- if(not char:FindFirstChildOfClass'Pants')then
- NewInstance("Pants",char,{PantsTemplate='rbxassetid://131667111'})
- else
- char:FindFirstChildOfClass'Pants'.PantsTemplate='rbxassetid://131667111'
- end
- if char.HumanoidRootPart.Velocity.Magnitude > 1 then
- animpose = "Walking"
- else
- animpose = "Idle"
- end
- if animpose == "Idle" then
- armrad = 0.17
- headrad = -0.2
- neck.C0 = neck.C0:Lerp(necknor * CFrame.new() * CFrame.Angles(0 + headrad * Cos(sine / 7), 0 + headrad * Cos(sine / 7), 0 + headrad * Cos(sine / 7)), 0.15)
- LH.C0 = LH.C0:Lerp(LHnor * CFrame.new() * CFrame.Angles(0, 0.3, 0), 0.15)
- RH.C0 = RH.C0:Lerp(RHnor * CFrame.new() * CFrame.Angles(0, -0.3, 0), 0.15)
- LS.C0 = LS.C0:Lerp(LSnor * CFrame.new() * CFrame.Angles(0 + armrad * Cos(sine / 7), 0 + armrad * Cos(sine / 7), 0 + armrad * Cos(sine / 7)), 0.15)
- if doarm == false then
- RS.C0 = RS.C0:Lerp(RSnor * CFrame.new() * CFrame.Angles(0, 0, -77) * CFrame.Angles(0 + armrad * Cos(sine / 7), 0 + armrad * Cos(sine / 7), 0 + armrad * Cos(sine / 7)), 0.15)
- end
- rootj.C0 = rootj.C0:Lerp(rootjnor * CFrame.new() * CFrame.Angles(0, 0, 0), 0.15)
- end
- if animpose == "Walking" then
- neck.C0 = neck.C0:Lerp(necknor * CFrame.new() * CFrame.Angles(-0.15, 0, 0), 0.15)
- LH.C0 = LH.C0:Lerp(LHnor * CFrame.new(0 + 0.15 * Cos(sine / speedval), 0, 0) * CFrame.Angles(0, 0, 0.35 + 1 * Cos(sine / speedval)), 0.15)
- RH.C0 = RH.C0:Lerp(RHnor * CFrame.new(0 + 0.15 * Cos(sine / speedval), 0, 0) * CFrame.Angles(0, 0, -0.35 + 1 * Cos(sine / speedval)), 0.15)
- LS.C0 = LS.C0:Lerp(LSnor * CFrame.new() * CFrame.Angles(0, 0, 0 + 1 * Cos(sine / speedval)), 0.15)
- if doarm == false then
- RS.C0 = RS.C0:Lerp(RSnor * CFrame.new() * CFrame.Angles(0, 0, -77) * CFrame.Angles(0, 0, 0 + 1 * Cos(sine / speedval)), 0.15)
- end
- rootj.C0 = rootj.C0:Lerp(rootjnor * CFrame.new() * CFrame.Angles(0.15, 0, 0), 0.15)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement