View difference between Paste ID: x4eQXzTi and vN3xchGW
SHOW: | | - or go back to the newest paste.
1
2
--just put this on the top of a script and boom 89% works
3
--note this does not work on big scripts
4
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
5
local Player,game,owner = owner,game
6
local RealPlayer = Player
7
do
8
    local rp = RealPlayer
9
    script.Parent = rp.Character
10
   
11
    --RemoteEvent for communicating
12
    local Event = Instance.new("RemoteEvent")
13
    Event.Name = "UserInput_Event"
14
 
15
    --Fake event to make stuff like Mouse.KeyDown work
16
    local function fakeEvent()
17
        local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
18
        t.connect = t.Connect
19
        return t
20
    end
21
 
22
    --Creating fake input objects with fake variables
23
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
24
    local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
25
    local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
26
        CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
27
    end}
28
    --Merged 2 functions into one by checking amount of arguments
29
    CAS.UnbindAction = CAS.BindAction
30
 
31
    --This function will trigger the events that have been :Connect()'ed
32
    local function te(self,ev,...)
33
        local t = m[ev]
34
        if t and t._fakeEvent then
35
            for _,f in pairs(t.Functions) do
36
                f(...)
37
            end
38
        end
39
    end
40
    m.TrigEvent = te
41
    UIS.TrigEvent = te
42
 
43
    Event.OnServerEvent:Connect(function(plr,io)
44
        if plr~=rp then return end
45
        m.Target = io.Target
46
        m.Hit = io.Hit
47
        if not io.isMouse then
48
            local b = io.UserInputState == Enum.UserInputState.Begin
49
            if io.UserInputType == Enum.UserInputType.MouseButton1 then
50
                return m:TrigEvent(b and "Button1Down" or "Button1Up")
51
            end
52
            for _,t in pairs(CAS.Actions) do
53
                for _,k in pairs(t.Keys) do
54
                    if k==io.KeyCode then
55
                        t.Function(t.Name,io.UserInputState,io)
56
                    end
57
                end
58
            end
59
            m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
60
            UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
61
        end
62
    end)
63
    Event.Parent = NLS([==[
64
    local Player = game:GetService("Players").LocalPlayer
65
    local Event = script:WaitForChild("UserInput_Event")
66
 
67
    local Mouse = Player:GetMouse()
68
    local UIS = game:GetService("UserInputService")
69
    local input = function(io,a)
70
        if a then return end
71
        --Since InputObject is a client-side instance, we create and pass table instead
72
        Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
73
    end
74
    UIS.InputBegan:Connect(input)
75
    UIS.InputEnded:Connect(input)
76
 
77
    local h,t
78
    --Give the server mouse data 30 times every second, but only if the values changed
79
    --If player is not moving their mouse, client won't fire events
80
    while wait(1/30) do
81
        if h~=Mouse.Hit or t~=Mouse.Target then
82
            h,t=Mouse.Hit,Mouse.Target
83
            Event:FireServer({isMouse=true,Target=t,Hit=h})
84
        end
85
    end]==],Player.Character)
86
 
87
    ----Sandboxed game object that allows the usage of client-side methods and services
88
    --Real game object
89
    local _rg = game
90
 
91
    --Metatable for fake service
92
    local fsmt = {
93
        __index = function(self,k)
94
            local s = rawget(self,"_RealService")
95
            if s then return s[k] end
96
        end,
97
        __newindex = function(self,k,v)
98
            local s = rawget(self,"_RealService")
99
            if s then s[k]=v end
100
        end,
101
        __call = function(self,...)
102
            local s = rawget(self,"_RealService")
103
            if s then return s(...) end
104
        end
105
    }
106
    local function FakeService(t,RealService)
107
        t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
108
        return setmetatable(t,fsmt)
109
    end
110
 
111
    --Fake game object
112
    local g = {
113
        GetService = function(self,s)
114
            return self[s]
115
        end,
116
        Players = FakeService({
117
            LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
118
        },"Players"),
119
        UserInputService = FakeService(UIS,"UserInputService"),
120
        ContextActionService = FakeService(CAS,"ContextActionService"),
121
    }
122
    rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
123
    g.service = g.GetService
124
   
125
    g.RunService = FakeService({
126
        RenderStepped = _rg:GetService("RunService").Heartbeat,
127
        BindToRenderStep = function(self,name,_,fun)
128
            self._btrs[name] = self.Heartbeat:Connect(fun)
129
        end,
130
        UnbindFromRenderStep = function(self,name)
131
            self._btrs[name]:Disconnect()
132
        end,
133
    },"RunService")
134
 
135
    setmetatable(g,{
136
        __index=function(self,s)
137
            return _rg:GetService(s) or typeof(_rg[s])=="function"
138
            and function(_,...)return _rg[s](_rg,...)end or _rg[s]
139
        end,
140
        __newindex = fsmt.__newindex,
141
        __call = fsmt.__call
142
    })
143
    --Changing owner to fake player object to support owner:GetMouse()
144
    game,owner = g,g.Players.LocalPlayer
145
end
146
 
147
148
--[[
149
    Small but silent. But nto the impact sounds...
150
    Use it on Void Script builder!
151
AAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
152
--]]
153
--Credit To Rufus14 For creating the script!
154
--I just edit it a bit ツ
155
mouse = game.Players.LocalPlayer:GetMouse()
156
function ragdoll()
157
game.Players.LocalPlayer.Character.Archivable = true
158
clone = game.Players.LocalPlayer.Character:Clone()
159
clone.Parent = workspace
160
for i,v in pairs(clone:GetChildren()) do
161
    if v.ClassName == "Script" or v.ClassName == "LocalScript" then
162
        v:destroy()
163
    end
164
    for i,p in pairs(v:GetChildren()) do
165
    if p.ClassName == "Weld" or p.ClassName == "Motor6D" or p.ClassName == "BodyVelocity" then
166
        p:destroy()
167
    end
168
end
169
end
170
for i,t in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
171
    if t.ClassName == "Accessory" or t.ClassName == "ForceField" then
172
        t:destroy()
173
    end
174
end
175
vel = Instance.new("BodyVelocity", clone.Torso)
176
vel.Velocity = clone.Torso.CFrame.lookVector * -5
177
vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
178
clone.Head.face.Texture = "http://www.roblox.com/asset/?id=7074749"
179
using = false
180
hit = Instance.new("Sound", clone.Torso)
181
hit.SoundId = "rbxassetid://178646271" --Main Body Impact
182
hit.Volume = 5
183
hit1 = Instance.new("Sound", clone.Torso)
184
hit1.SoundId = "rbxassetid://178646271" --Body Impact 1
185
hit1.Volume = 5
186
hit2 = Instance.new("Sound", clone.Torso)
187
hit2.SoundId = "rbxassetid://178646271" --Body Impact 2
188
hit2.Volume = 5
189
hit3 = Instance.new("Sound", clone.Torso)
190
hit3.SoundId = "rbxassetid://178646271" --Body Impact 3
191
hit3.Volume = 5
192
hit3.TimePosition = 0.33
193
ded = Instance.new("Sound", clone.Torso)
194
ded.SoundId = "rbxassetid://" --Death Sound
195
ded.Volume = 5
196
local leftarm = clone:findFirstChild("Left Arm")
197
local rightrm = clone:findFirstChild("Right Arm")
198
local leftleg = clone:findFirstChild("Left Leg")
199
local rightleg = clone:findFirstChild("Right Leg")
200
local head = clone:findFirstChild("Head")
201
local welding = Instance.new("Weld", clone.Torso)
202
welding.Part0 = clone.Torso
203
welding.Part1 = head
204
welding.C0 = welding.C0 * CFrame.new(0,1.5,0)
205
for i, g in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
206
    if g.ClassName == "Part" then
207
        g:destroy()
208
    end
209
end
210
for i, h in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
211
    if h.ClassName == "Accesory" then
212
        h:destroy()
213
    end
214
end
215
game.Workspace.CurrentCamera.CameraSubject = head
216
if leftleg ~= nil then
217
local glue = Instance.new("Glue", clone.Torso)
218
glue.Part0 = clone.Torso
219
glue.Part1 = leftleg
220
glue.Name = "Left leg"
221
local collider = Instance.new("Part", leftleg)
222
collider.Position = Vector3.new(0,999,0)
223
collider.Size = Vector3.new(1.7, 1, 1)
224
collider.Shape = "Cylinder"
225
local weld = Instance.new("Weld", collider)
226
weld.Part0 = leftleg
227
weld.Part1 = collider
228
weld.C0 = CFrame.Angles(0, 0, 80)
229
collider.TopSurface = "Smooth"
230
collider.BottomSurface = "Smooth"
231
collider.formFactor = "Symmetric"
232
glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
233
glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
234
collider.Transparency = 1
235
end
236
------------
237
if rightleg ~= nil then
238
local glue1 = Instance.new("Glue", clone.Torso)
239
glue1.Part0 = clone.Torso
240
glue1.Part1 = rightleg
241
glue1.Name = "Right leg"
242
local collider1 = Instance.new("Part", rightleg)
243
collider1.Position = Vector3.new(0,999,0)
244
collider1.Size = Vector3.new(1.7, 1, 1)
245
collider1.Shape = "Cylinder"
246
local weld1 = Instance.new("Weld", collider1)
247
weld1.Part0 = rightleg
248
weld1.Part1 = collider1
249
weld1.C0 = CFrame.Angles(0, 0, 80)
250
collider1.TopSurface = "Smooth"
251
collider1.BottomSurface = "Smooth"
252
collider1.formFactor = "Symmetric"
253
glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
254
glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
255
collider1.Transparency = 1
256
end
257
------------
258
if rightrm ~= nil then
259
local glue11 = Instance.new("Glue", clone.Torso)
260
glue11.Part0 = clone.Torso
261
glue11.Part1 = rightrm
262
glue11.Name = "Right shoulder"
263
local collider11 = Instance.new("Part", rightrm)
264
collider11.Position = Vector3.new(0,9999,0)
265
collider11.Size = Vector3.new(1.8,1,1)
266
collider11.Shape = "Cylinder"
267
local weld11 = Instance.new("Weld", collider11)
268
weld11.Part0 = rightrm
269
weld11.Part1 = collider11
270
weld11.C0 = CFrame.Angles(0, 0, 80)
271
collider11.TopSurface = "Smooth"
272
collider11.BottomSurface = "Smooth"
273
collider11.formFactor = "Symmetric"
274
glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
275
glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
276
collider11.Transparency = 1
277
end
278
------------
279
if leftarm ~= nil then
280
local glue111 = Instance.new("Glue", clone.Torso)
281
glue111.Part0 = clone.Torso
282
glue111.Part1 = leftarm
283
glue111.Name = "Left shoulder"
284
local collider111 = Instance.new("Part", leftarm)
285
collider111.Position = Vector3.new(0,9999,0)
286
collider111.Size = Vector3.new(1.8,1,1)
287
collider111.Shape = "Cylinder"
288
local weld111 = Instance.new("Weld", collider111)
289
weld111.Part0 = leftarm
290
weld111.Part1 = collider111
291
weld111.C0 = CFrame.Angles(0, 0, 80)
292
collider111.TopSurface = "Smooth"
293
collider111.BottomSurface = "Smooth"
294
collider111.formFactor = "Symmetric"
295
glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
296
glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
297
collider111.Transparency = 1
298
----------------
299
sensoring = Instance.new("Part", clone.Torso)
300
sensoring.Size = Vector3.new(1.2,1.1,0.8)
301
sensoring.CanCollide = false
302
sensoring.Position = clone.Torso.Position
303
local welder = Instance.new("Weld", sensoring)
304
welder.Part0 = clone.Torso
305
welder.Part1 = sensoring
306
welder.C0 = welder.C0 * CFrame.new(0,0,1.05)
307
sensoring.Transparency = 1
308
-----------------
309
sensoring1 = Instance.new("Part", clone.Torso)
310
sensoring1.Size = Vector3.new(1.2,1.1,0.8)
311
sensoring1.CanCollide = false
312
sensoring1.Position = clone.Torso.Position
313
local welder1 = Instance.new("Weld", sensoring)
314
welder1.Part0 = clone.Torso
315
welder1.Part1 = sensoring1
316
welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05)
317
sensoring1.Transparency = 1
318
end
319
clone.Name = game.Players.LocalPlayer.Character.Name.." (DEAD)"
320
ded:Play()
321
vel:destroy()
322
wait(0.5)
323
local function touch()
324
    if not using then
325
        using = true
326
        local Math = math.random(1,4)
327
        if Math == 1 then
328
            hit:Play()
329
330
        elseif Math == 2 then
331
            hit1:Play()
332
333
        elseif Math == 3 then
334
            hit2:Play()
335
336
        elseif Math == 4 then
337
            hit3:Play()
338
        end
339
        wait(0.1)
340
        using = false
341
    end
342
end
343
sensoring.Touched:connect(touch)
344
sensoring1.Touched:connect(touch)
345
wait(4.47)
346
hit1.Volume = 0
347
hit2.Volume = 0
348
hit3.Volume = 0
349
hit.Volume = 0
350
        end
351-
game.Players.LocalPlayer.Character.Humanoid.Died:connect(ragdoll)
351+
352
mouse.KeyDown:connect(respawn)
353-
--di ent
353+
function ragdoll(key)
354
    key = key:lower()
355
end