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 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
- --By SincereProdeadZ
- mouse = game.Players.LocalPlayer:GetMouse()
- using = false
- ragdolling = false
- hit = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
- hit.SoundId = "rbxassetid://1542642349"
- hit.Volume = 2
- hit1 = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
- hit1.SoundId = "rbxassetid://1542642349"
- hit1.Volume = 2
- hit2 = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
- hit2.SoundId = "rbxassetid://1542642349"
- hit2.Volume = 2
- hit3 = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
- hit3.SoundId = "rbxassetid://1542642349"
- hit3.Volume = 2
- hit3.TimePosition = 0.33
- stand = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
- stand.SoundId = "rbxassetid://162456532"
- stand.Volume = 3
- print("Press R to ragdollify")
- function respawn(key)
- key = key:lower()
- if key == "t" then
- stand:Play()
- if ragdolling then
- ragdolling = false
- lshclone.Parent = game.Players.LocalPlayer.Character.Torso
- glue:destroy()
- rshclone.Parent = game.Players.LocalPlayer.Character.Torso
- glue1:destroy()
- lhclone.Parent = game.Players.LocalPlayer.Character.Torso
- glue11:destroy()
- rhclone.Parent = game.Players.LocalPlayer.Character.Torso
- glue111:destroy()
- collider:destroy()
- collider1:destroy()
- collider11:destroy()
- collider111:destroy()
- sensoring:destroy()
- sensoring1:destroy()
- game.Players.LocalPlayer.Character.Torso.SpotLight:destroy()
- game.Players.LocalPlayer.Character.Humanoid.PlatformStand = false
- end
- end
- end
- mouse.KeyDown:connect(respawn)
- function ragdoll(key)
- key = key:lower()
- if key == "r" then
- if not ragdolling then
- ragdolling = true
- local light = Instance.new("SpotLight", game.Players.LocalPlayer.Character.Torso)
- game.Players.LocalPlayer.Character.Humanoid.PlatformStand = true
- lshclone = game.Players.LocalPlayer.Character.Torso["Left Shoulder"]:Clone()
- rshclone = game.Players.LocalPlayer.Character.Torso["Right Shoulder"]:Clone()
- lhclone = game.Players.LocalPlayer.Character.Torso["Left Hip"]:Clone()
- rhclone = game.Players.LocalPlayer.Character.Torso["Right Hip"]:Clone()
- local leftarm = game.Players.LocalPlayer.Character["Left Arm"]
- local rightrm = game.Players.LocalPlayer.Character["Right Arm"]
- local leftleg = game.Players.LocalPlayer.Character["Left Leg"]
- local rightleg = game.Players.LocalPlayer.Character["Right Leg"]
- game.Players.LocalPlayer.Character.Torso["Left Hip"]:destroy()
- local head = game.Players.LocalPlayer.Character.Head
- glue = Instance.new("Glue", game.Players.LocalPlayer.Character.Torso)
- glue.Part0 = game.Players.LocalPlayer.Character.Torso
- glue.Part1 = leftleg
- glue.Name = "Left leg"
- collider = Instance.new("Part", leftleg)
- collider.Position = Vector3.new(0,999,0)
- collider.Size = Vector3.new(1.5, 1, 1)
- collider.Shape = "Cylinder"
- local weld = Instance.new("Weld", collider)
- weld.Part0 = leftleg
- weld.Part1 = collider
- weld.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
- collider.TopSurface = "Smooth"
- collider.BottomSurface = "Smooth"
- collider.formFactor = "Symmetric"
- glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- collider.Transparency = 1
- ------------
- game.Players.LocalPlayer.Character.Torso["Right Hip"]:destroy()
- glue1 = Instance.new("Glue", game.Players.LocalPlayer.Character.Torso)
- glue1.Part0 = game.Players.LocalPlayer.Character.Torso
- glue1.Part1 = rightleg
- glue1.Name = "Right leg"
- collider1 = Instance.new("Part", rightleg)
- collider1.Position = Vector3.new(0,9999,0)
- collider1.Size = Vector3.new(1.5, 1, 1)
- collider1.Shape = "Cylinder"
- local weld1 = Instance.new("Weld", collider1)
- weld1.Part0 = rightleg
- weld1.Part1 = collider1
- weld1.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
- collider1.TopSurface = "Smooth"
- collider1.BottomSurface = "Smooth"
- collider1.formFactor = "Symmetric"
- glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- collider1.Transparency = 1
- ------------
- game.Players.LocalPlayer.Character.Torso["Right Shoulder"]:destroy()
- glue11 = Instance.new("Glue", game.Players.LocalPlayer.Character.Torso)
- glue11.Part0 = game.Players.LocalPlayer.Character.Torso
- glue11.Part1 = rightrm
- glue11.Name = "Right shoulder"
- collider11 = Instance.new("Part", rightrm)
- collider11.Position = Vector3.new(0,9999,0)
- collider11.Size = Vector3.new(1.8,1,1)
- collider11.Shape = "Cylinder"
- local weld11 = Instance.new("Weld", collider11)
- weld11.Part0 = rightrm
- weld11.Part1 = collider11
- weld11.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
- collider11.TopSurface = "Smooth"
- collider11.BottomSurface = "Smooth"
- collider11.formFactor = "Symmetric"
- glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- collider11.Transparency = 1
- ------------
- game.Players.LocalPlayer.Character.Torso["Left Shoulder"]:destroy()
- glue111 = Instance.new("Glue", game.Players.LocalPlayer.Character.Torso)
- glue111.Part0 = game.Players.LocalPlayer.Character.Torso
- glue111.Part1 = leftarm
- glue111.Name = "Left shoulder"
- collider111 = Instance.new("Part", leftarm)
- collider111.Position = Vector3.new(0,9999,0)
- collider111.Size = Vector3.new(1.5, 1, 1)
- collider111.Shape = "Cylinder"
- local weld111 = Instance.new("Weld", collider111)
- weld111.Part0 = leftarm
- weld111.Part1 = collider111
- weld111.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
- collider111.TopSurface = "Smooth"
- collider111.BottomSurface = "Smooth"
- collider111.formFactor = "Symmetric"
- glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- collider111.Transparency = 1
- -----------------
- sensoring = Instance.new("Part", game.Players.LocalPlayer.Character.Torso)
- sensoring.Size = Vector3.new(1.2,1.1,0.8)
- sensoring.CanCollide = false
- sensoring.Position = game.Players.LocalPlayer.Character.Torso.Position
- local welder = Instance.new("Weld", sensoring)
- welder.Part0 = game.Players.LocalPlayer.Character.Torso
- welder.Part1 = sensoring
- welder.C0 = welder.C0 * CFrame.new(0,0,1.05)
- sensoring.Transparency = 1
- -----------------
- sensoring1 = Instance.new("Part", game.Players.LocalPlayer.Character.Torso)
- sensoring1.Size = Vector3.new(1.2,1.1,0.8)
- sensoring1.CanCollide = false
- sensoring1.Position = game.Players.LocalPlayer.Character.Torso.Position
- local welder1 = Instance.new("Weld", sensoring)
- welder1.Part0 = game.Players.LocalPlayer.Character.Torso
- welder1.Part1 = sensoring1
- welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05)
- sensoring1.Transparency = 1
- local function touch()
- if not using then
- using = true
- local Math = math.random(1,4)
- if Math == 1 then
- hit:Play()
- end
- if Math == 2 then
- hit1:Play()
- end
- if Math == 3 then
- hit2:Play()
- end
- if Math == 4 then
- hit3:Play()
- end
- wait(0.1)
- using = false
- end
- end
- sensoring.Touched:connect(touch)
- sensoring1.Touched:connect(touch)
- end
- end
- end
- mouse.KeyDown:connect(ragdoll)
- --di ent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement