Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- couldnt find neck snap sound probably because its violent.
- 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 by Mokiros")
- local rp = RealPlayer
- script.Parent = rp.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,Functions={},Connect=function(self,f)table.insert(self.Functions,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(),Button2Up=fakeEvent(),Button2Down=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 then
- for _,f in pairs(t.Functions) do
- f(...)
- end
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=rp then return end
- m.Target = io.Target
- m.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return m:TrigEvent(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
- 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 Mouse = Player:GetMouse()
- 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,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- 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)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local _rg = game
- --Metatable for fake service
- local fsmt = {
- __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 _rg:GetService(RealService) or RealService
- return setmetatable(t,fsmt)
- end
- --Fake game object
- local g = {
- GetService = function(self,s)
- return rawget(self,s) or _rg:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = _rg: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(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- FakeService(g,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- player = game.Players.LocalPlayer
- char = player.Character
- function lerp(weld,startpos,endpos,amntime,longatend)
- local waited = 0
- for i=1,amntime*100 do
- if longatend == true then
- startpos = weld.C0
- end
- weld.C0 = startpos:lerp(endpos,i/(amntime*100))
- wait(0.01)
- waited=waited+0.01
- end
- end
- snapping = false
- mouse = player:GetMouse()
- mas = char
- Weld0 = Instance.new("Weld")
- Weld1 = Instance.new("Weld")
- Weld2 = Instance.new("Weld")
- Weld3 = Instance.new("Weld")
- Weld4 = Instance.new("Weld")
- Weld0.Name = "Weld3"
- Weld0.Parent = mas
- Weld0.C0 = CFrame.new(-1.5, 0, 0, -4.37113883e-08, 0, 1, 0, 1, 0, -1, 0, -4.37113883e-08)
- Weld0.Part0 = nil
- Weld0.Part1 = nil
- Weld0.part1 = nil
- Weld1.Parent = mas
- Weld1.C0 = CFrame.new(-1, -1.5, 0, 0.707106769, 0.707106769, 0, -0.707106769, 0.707106769, 0, 0, 0, 1)
- Weld1.Part0 = nil
- Weld1.Part1 = nil
- Weld1.part1 = nil
- Weld2.Name = "Weld2"
- Weld2.Parent = mas
- Weld2.C0 = CFrame.new(0.5, -2, 0, -4.37113883e-08, 0, -1, 0, 1, 0, 1, 0, -4.37113883e-08)
- Weld2.Part0 = nil
- Weld2.Part1 = nil
- Weld2.part1 = nil
- Weld3.Name = "Weld4"
- Weld3.Parent = mas
- Weld3.C0 = CFrame.new(1.5, 1, 0, 1, 0, 0, 0, -1, -8.74227766e-08, 0, 8.74227766e-08, -1)
- Weld3.Part0 = nil
- Weld3.Part1 = nil
- Weld3.part1 = nil
- Weld4.Name = "Weld5"
- Weld4.Parent = mas
- Weld4.C0 = CFrame.new(0, 1.5, 0, -4.37113883e-08, 0, 1, 0, 1, 0, -1, 0, -4.37113883e-08)
- Weld4.Part0 = nil
- Weld4.Part1 = nil
- Weld4.part1 = nil
- Weld5 = Instance.new("Weld")
- Weld6 = Instance.new("Weld")
- Weld5.Name = "Weld3"
- Weld5.Parent = mas
- Weld5.C0 = CFrame.new(-1.20000005, 1, 0, 0.707106769, -0.707106769, 0, -0.707106769, -0.707106769, 8.74227766e-08, -6.18172393e-08, -6.18172393e-08, -1)
- Weld5.Part0 = nil
- Weld5.Part1 = nil
- Weld5.part1 = nil
- Weld6.Name = "Weld4"
- Weld6.Parent = mas
- Weld6.C0 = CFrame.new(1.20000005, 1, 0, 0.707106769, 0.707106769, 0, 0.707106769, -0.707106769, 8.74227766e-08, 6.18172393e-08, -6.18172393e-08, -1)
- Weld6.Part0 = nil
- Weld6.Part1 = nil
- Weld6.part1 = nil
- mouse.Button1Down:Connect(function()
- if snapping == false then
- snapping = true
- char.Humanoid.WalkSpeed = 0
- rightshoulder = Instance.new("Weld",char)
- rightshoulder.Part0 = char.Torso
- rightshoulder.Part1 = char["Right Arm"]
- rightshoulder.C0 = CFrame.new(1.5,0,0)
- leftshoulder = Instance.new("Weld",char)
- leftshoulder.Part0 = char.Torso
- leftshoulder.Part1 = char["Left Arm"]
- leftshoulder.C0 = CFrame.new(-1.5,0,0)
- lefthip = Instance.new("Weld",char)
- lefthip.Part0 = char.Torso
- lefthip.Part1 = char["Left Leg"]
- lefthip.C0 = CFrame.new(0.5,-2,0)
- righthip = Instance.new("Weld",char)
- righthip.Part0 = char.Torso
- righthip.Part1 = char["Right Leg"]
- righthip.C0 = CFrame.new(-0.5,-2,0)
- neck = Instance.new("Weld",char)
- neck.Part0 = char.Torso
- neck.Part1 = char.Head
- neck.C0 = CFrame.new(0,1.5,0)
- cor = coroutine.wrap(function()
- lerp(leftshoulder,leftshoulder.C0,Weld5.C0,0.06)
- end)
- cor()
- cor = coroutine.wrap(function()
- lerp(rightshoulder,rightshoulder.C0,Weld6.C0,0.06)
- end)
- cor()
- wait(0.6)
- oof = Instance.new("Sound",char.Head)
- oof.Volume = 10
- oof.SoundId = "rbxassetid://1093102664"
- oof:Play()
- cor = coroutine.wrap(function()
- lerp(neck,neck.C0,Weld4.C0,0.06)
- end)
- cor()
- wait(0.6)
- rootpart = char.HumanoidRootPart.RootJoint
- ok = rootpart.Parent:Clone()
- ok.Name = "ok"
- ok.Parent = rootpart.Parent.Parent
- ok.Anchored = true
- rootjoint = Instance.new("Weld",ok)
- rootjoint.Part0 = ok
- rootjoint.Part1 = char.Torso
- rootjoint.C0 = CFrame.new(0,0,0) * CFrame.Angles(-math.rad(90),0,0)
- cor = coroutine.wrap(function()
- lerp(rootjoint,rootjoint.C0,CFrame.new(0,-2.5,0) * CFrame.Angles(-math.rad(90),math.rad(0),-math.rad(0)),0.06)
- end)
- cor()
- cor = coroutine.wrap(function()
- lerp(leftshoulder,leftshoulder.C0,Weld0.C0,0.06)
- end)
- cor()
- cor = coroutine.wrap(function()
- lerp(rightshoulder,rightshoulder.C0,Weld3.C0,0.06)
- end)
- cor()
- cor = coroutine.wrap(function()
- lerp(lefthip,lefthip.C0,Weld1.C0,0.06)
- end)
- cor()
- cor = coroutine.wrap(function()
- lerp(righthip,righthip.C0,Weld2.C0,0.06)
- end)
- cor()
- end
- end)
Add Comment
Please, Sign In to add comment