SHOW:
|
|
- or go back to the newest paste.
| 1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
| 2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 3 | local Player,game,owner = owner,game | |
| 4 | local RealPlayer = Player | |
| 5 | do | |
| 6 | print("FE Compatibility code V2 by Mokiros")
| |
| 7 | local RealPlayer = RealPlayer | |
| 8 | script.Parent = RealPlayer.Character | |
| 9 | ||
| 10 | --Fake event to make stuff like Mouse.KeyDown work | |
| 11 | local Disconnect_Function = function(this) | |
| 12 | this[1].Functions[this[2]] = nil | |
| 13 | end | |
| 14 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
| |
| 15 | local FakeEvent_Metatable = {__index={
| |
| 16 | Connect = function(this,f) | |
| 17 | local i = tostring(math.random(0,10000)) | |
| 18 | while this.Functions[i] do | |
| 19 | i = tostring(math.random(0,10000)) | |
| 20 | end | |
| 21 | this.Functions[i] = f | |
| 22 | return setmetatable({this,i},Disconnect_Metatable)
| |
| 23 | end | |
| 24 | }} | |
| 25 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
| 26 | local function fakeEvent() | |
| 27 | return setmetatable({Functions={}},FakeEvent_Metatable)
| |
| 28 | end | |
| 29 | ||
| 30 | --Creating fake input objects with fake variables | |
| 31 | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
| |
| 32 | FakeMouse.keyUp = FakeMouse.KeyUp | |
| 33 | FakeMouse.keyDown = FakeMouse.KeyDown | |
| 34 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 35 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 36 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 37 | end} | |
| 38 | --Merged 2 functions into one by checking amount of arguments | |
| 39 | CAS.UnbindAction = CAS.BindAction | |
| 40 | ||
| 41 | --This function will trigger the events that have been :Connect()'ed | |
| 42 | local function TriggerEvent(self,ev,...) | |
| 43 | for _,f in pairs(self[ev].Functions) do | |
| 44 | f(...) | |
| 45 | end | |
| 46 | end | |
| 47 | FakeMouse.TriggerEvent = TriggerEvent | |
| 48 | UIS.TriggerEvent = TriggerEvent | |
| 49 | ||
| 50 | --Client communication | |
| 51 | local Event = Instance.new("RemoteEvent")
| |
| 52 | Event.Name = "UserInput_Event" | |
| 53 | Event.OnServerEvent:Connect(function(plr,io) | |
| 54 | if plr~=RealPlayer then return end | |
| 55 | FakeMouse.Target = io.Target | |
| 56 | FakeMouse.Hit = io.Hit | |
| 57 | if not io.isMouse then | |
| 58 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 59 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 60 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
| 61 | end | |
| 62 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
| 63 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
| 64 | end | |
| 65 | for _,t in pairs(CAS.Actions) do | |
| 66 | for _,k in pairs(t.Keys) do | |
| 67 | if k==io.KeyCode then | |
| 68 | t.Function(t.Name,io.UserInputState,io) | |
| 69 | end | |
| 70 | end | |
| 71 | end | |
| 72 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 73 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 74 | end | |
| 75 | end) | |
| 76 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
| |
| 77 | local Mouse = owner:GetMouse() | |
| 78 | local UIS = game:GetService("UserInputService")
| |
| 79 | local input = function(io,RobloxHandled) | |
| 80 | if RobloxHandled then return end | |
| 81 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 82 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 83 | end | |
| 84 | UIS.InputBegan:Connect(input) | |
| 85 | UIS.InputEnded:Connect(input) | |
| 86 | ||
| 87 | local h,t | |
| 88 | --Give the server mouse data every second frame, but only if the values changed | |
| 89 | --If player is not moving their mouse, client won't fire events | |
| 90 | local HB = game:GetService("RunService").Heartbeat
| |
| 91 | while true do | |
| 92 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 93 | h,t=Mouse.Hit,Mouse.Target | |
| 94 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 95 | end | |
| 96 | --Wait 2 frames | |
| 97 | for i=1,2 do | |
| 98 | HB:Wait() | |
| 99 | end | |
| 100 | end]==],script) | |
| 101 | ||
| 102 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 103 | --Real game object | |
| 104 | local RealGame = game | |
| 105 | ||
| 106 | --Metatable for fake service | |
| 107 | local FakeService_Metatable = {
| |
| 108 | __index = function(self,k) | |
| 109 | local s = rawget(self,"_RealService") | |
| 110 | if s then | |
| 111 | return typeof(s[k])=="function" | |
| 112 | and function(_,...)return s[k](s,...)end or s[k] | |
| 113 | end | |
| 114 | end, | |
| 115 | __newindex = function(self,k,v) | |
| 116 | local s = rawget(self,"_RealService") | |
| 117 | if s then s[k]=v end | |
| 118 | end | |
| 119 | } | |
| 120 | local function FakeService(t,RealService) | |
| 121 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
| 122 | return setmetatable(t,FakeService_Metatable) | |
| 123 | end | |
| 124 | ||
| 125 | --Fake game object | |
| 126 | local FakeGame = {
| |
| 127 | GetService = function(self,s) | |
| 128 | return rawget(self,s) or RealGame:GetService(s) | |
| 129 | end, | |
| 130 | Players = FakeService({
| |
| 131 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
| |
| 132 | },"Players"), | |
| 133 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 134 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 135 | RunService = FakeService({
| |
| 136 | _btrs = {},
| |
| 137 | RenderStepped = RealGame:GetService("RunService").Heartbeat,
| |
| 138 | BindToRenderStep = function(self,name,_,fun) | |
| 139 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 140 | end, | |
| 141 | UnbindFromRenderStep = function(self,name) | |
| 142 | self._btrs[name]:Disconnect() | |
| 143 | end, | |
| 144 | },"RunService") | |
| 145 | } | |
| 146 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
| 147 | FakeGame.service = FakeGame.GetService | |
| 148 | FakeService(FakeGame,game) | |
| 149 | --Changing owner to fake player object to support owner:GetMouse() | |
| 150 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
| 151 | end | |
| 152 | --By naser2018 | |
| 153 | mouse = game.Players.LocalPlayer:GetMouse() | |
| 154 | gun = Instance.new("Part", game.Players.LocalPlayer.Character)
| |
| 155 | gun.Size = Vector3.new(0.5, 1, 2) | |
| 156 | gun.CanCollide = false | |
| 157 | gun:BreakJoints() | |
| 158 | weld = Instance.new("Weld", gun)
| |
| 159 | weld.Part0 = game.Players.LocalPlayer.Character["Right Arm"] | |
| 160 | weld.Part1 = gun | |
| 161 | weld.C0 = weld.C0 * CFrame.new(-0.2,-1.7,-0.25) * CFrame.Angles(0,1.6,-1.53) | |
| 162 | mesh = Instance.new("SpecialMesh", gun)
| |
| 163 | mesh.MeshId = "rbxassetid://623102664" | |
| 164 | mesh.TextureId = "rbxassetid://623102879" | |
| 165 | mesh.Scale = Vector3.new(0.01,0.01,0.01) | |
| 166 | local rhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso)
| |
| 167 | rhandweld.Part0 = game.Players.LocalPlayer.Character.Torso | |
| 168 | rhandweld.Part1 = game.Players.LocalPlayer.Character["Right Arm"] | |
| 169 | rhandweld.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
| 170 | rhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
| 171 | shooting = false | |
| 172 | for i = 1,2 do | |
| 173 | wait() | |
| 174 | rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.03) | |
| 175 | end | |
| 176 | for i = 1,2 do | |
| 177 | wait() | |
| 178 | rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.07) | |
| 179 | end | |
| 180 | for i = 1,7 do | |
| 181 | wait() | |
| 182 | rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.17) | |
| 183 | end | |
| 184 | for i = 1,2 do | |
| 185 | wait() | |
| 186 | rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.07) | |
| 187 | end | |
| 188 | for i = 1,2 do | |
| 189 | wait() | |
| 190 | rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.03) | |
| 191 | end | |
| 192 | function shoot() | |
| 193 | if not shooting then | |
| 194 | shooting = true | |
| 195 | local shotsound = Instance.new("Sound", gun)
| |
| 196 | shotsound.EmitterSize = 1 | |
| 197 | shotsound.SoundId = "rbxassetid://139593133" | |
| 198 | shotsound.Volume = 3 | |
| 199 | shotsound:Play() | |
| 200 | local missle = Instance.new("Part", workspace)
| |
| 201 | missle.Size = Vector3.new(0.05,0.05,0.05) | |
| 202 | missle.CanCollide = false | |
| 203 | missle.BrickColor = BrickColor.new("New Yeller")
| |
| 204 | missle.Shape = "Ball" | |
| 205 | missle.CFrame = gun.CFrame | |
| 206 | missle:BreakJoints() | |
| 207 | local velo = Instance.new("BodyVelocity", missle)
| |
| 208 | velo.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
| 209 | velo.Velocity = mouse.Hit.lookVector * 190 | |
| 210 | for i = 1,2 do | |
| 211 | weld.C0 = weld.C0 * CFrame.Angles(0,0,0.14) | |
| 212 | rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,0.14) | |
| 213 | end | |
| 214 | for i = 1,2 do | |
| 215 | wait() | |
| 216 | weld.C0 = weld.C0 * CFrame.Angles(0,0,-0.07) | |
| 217 | rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,-0.07) | |
| 218 | end | |
| 219 | local function kill(part) | |
| 220 | local hum = part.Parent:findFirstChild("Humanoid")
| |
| 221 | local torso = part.Parent:findFirstChild("Torso")
| |
| 222 | local larm = part.Parent:findFirstChild("Left Arm")
| |
| 223 | local rarm = part.Parent:findFirstChild("Right Arm")
| |
| 224 | local lleg = part.Parent:findFirstChild("Left Leg")
| |
| 225 | local rleg = part.Parent:findFirstChild("Right Leg")
| |
| 226 | missle:destroy() | |
| 227 | if hum ~= nil then | |
| 228 | if torso then | |
| 229 | hum.Health = hum.Health - math.random(25,68) | |
| 230 | local shotsound1 = Instance.new("Sound", torso)
| |
| 231 | shotsound1:Play() | |
| 232 | shotsound1.EmitterSize = 2 | |
| 233 | shotsound1.SoundId = "rbxassetid://144884872" | |
| 234 | shotsound1.Volume = 8 | |
| 235 | shotsound1:Play() | |
| 236 | local shotsound1 = Instance.new("Sound", torso)
| |
| 237 | shotsound1:Play() | |
| 238 | shotsound1.EmitterSize = 2 | |
| 239 | shotsound1.SoundId = "rbxassetid://175272131" | |
| 240 | shotsound1.Volume = 8 | |
| 241 | shotsound1:Play() | |
| 242 | using = false | |
| 243 | hit = Instance.new("Sound", torso)
| |
| 244 | hit.SoundId = "rbxassetid://260430060" | |
| 245 | hit.Volume = 5 | |
| 246 | hit1 = Instance.new("Sound", torso)
| |
| 247 | hit1.SoundId = "rbxassetid://138087186" | |
| 248 | hit1.Volume = 5 | |
| 249 | hit2 = Instance.new("Sound", torso)
| |
| 250 | hit2.SoundId = "rbxassetid://131237241" | |
| 251 | hit2.Volume = 5 | |
| 252 | hit3 = Instance.new("Sound", torso)
| |
| 253 | hit3.SoundId = "rbxassetid://278062209" | |
| 254 | hit3.Volume = 5 | |
| 255 | hit3.TimePosition = 0.33 | |
| 256 | print("You killed "..hum.Parent.Name)
| |
| 257 | hum.PlatformStand = true | |
| 258 | ---------- | |
| 259 | local lhip = torso:findFirstChild("Left Hip")
| |
| 260 | if lhip then | |
| 261 | --- | |
| 262 | torso["Left Hip"]:destroy() | |
| 263 | local head = game.Players.LocalPlayer.Character.Head | |
| 264 | local glue = Instance.new("Glue", torso)
| |
| 265 | glue.Part0 = torso | |
| 266 | glue.Part1 = torso.Parent["Left Leg"] | |
| 267 | glue.Name = "Left leg" | |
| 268 | local collider = Instance.new("Part", torso.Parent["Left Leg"])
| |
| 269 | collider.Position = Vector3.new(0,999,0) | |
| 270 | collider.Size = Vector3.new(1.7, 1, 1) | |
| 271 | collider.Shape = "Cylinder" | |
| 272 | local weld = Instance.new("Weld", collider)
| |
| 273 | weld.Part0 = torso.Parent["Left Leg"] | |
| 274 | weld.Part1 = collider | |
| 275 | weld.C0 = CFrame.Angles(0, 0, 80) | |
| 276 | collider.TopSurface = "Smooth" | |
| 277 | collider.BottomSurface = "Smooth" | |
| 278 | collider.formFactor = "Symmetric" | |
| 279 | glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 280 | glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 281 | collider.Transparency = 1 | |
| 282 | end | |
| 283 | local rhip = torso:findFirstChild("Right Hip")
| |
| 284 | if rhip then | |
| 285 | ------------ | |
| 286 | torso["Right Hip"]:destroy() | |
| 287 | local glue1 = Instance.new("Glue", torso)
| |
| 288 | glue1.Part0 = torso | |
| 289 | glue1.Part1 = torso.Parent["Right Leg"] | |
| 290 | glue1.Name = "Right leg" | |
| 291 | local collider1 = Instance.new("Part", torso.Parent["Right Leg"])
| |
| 292 | collider1.Position = Vector3.new(0,9999,0) | |
| 293 | collider1.Size = Vector3.new(1.7, 1, 1) | |
| 294 | collider1.Shape = "Cylinder" | |
| 295 | local weld1 = Instance.new("Weld", collider1)
| |
| 296 | weld1.Part0 = torso.Parent["Right Leg"] | |
| 297 | weld1.Part1 = collider1 | |
| 298 | weld1.C0 = CFrame.Angles(0, 0, 80) | |
| 299 | collider1.TopSurface = "Smooth" | |
| 300 | collider1.BottomSurface = "Smooth" | |
| 301 | collider1.formFactor = "Symmetric" | |
| 302 | glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 303 | glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 304 | collider1.Transparency = 1 | |
| 305 | end | |
| 306 | ------------ | |
| 307 | local rshoulder = torso:findFirstChild("Right Shoulder")
| |
| 308 | if rshoulder then | |
| 309 | torso["Right Shoulder"]:destroy() | |
| 310 | local glue11 = Instance.new("Glue", torso)
| |
| 311 | glue11.Part0 = torso | |
| 312 | glue11.Part1 = torso.Parent["Right Arm"] | |
| 313 | glue11.Name = "Right shoulder" | |
| 314 | local collider11 = Instance.new("Part", torso.Parent["Right Arm"])
| |
| 315 | collider11.Position = Vector3.new(0,9999,0) | |
| 316 | collider11.Size = Vector3.new(1.8,1,1) | |
| 317 | collider11.Shape = "Cylinder" | |
| 318 | local weld11 = Instance.new("Weld", collider11)
| |
| 319 | weld11.Part0 = torso.Parent["Right Arm"] | |
| 320 | weld11.Part1 = collider11 | |
| 321 | weld11.C0 = CFrame.Angles(0, 0, 80) | |
| 322 | collider11.TopSurface = "Smooth" | |
| 323 | collider11.BottomSurface = "Smooth" | |
| 324 | collider11.formFactor = "Symmetric" | |
| 325 | glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
| 326 | glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
| 327 | collider11.Transparency = 1 | |
| 328 | end | |
| 329 | ------------ | |
| 330 | local lshoulder = torso:findFirstChild("Left Shoulder")
| |
| 331 | if lshoulder then | |
| 332 | torso["Left Shoulder"]:destroy() | |
| 333 | local glue111 = Instance.new("Glue", torso)
| |
| 334 | glue111.Part0 = torso | |
| 335 | glue111.Part1 = torso.Parent["Left Arm"] | |
| 336 | glue111.Name = "Left shoulder" | |
| 337 | local collider111 = Instance.new("Part", torso.Parent["Left Arm"])
| |
| 338 | collider111.Position = Vector3.new(0,9999,0) | |
| 339 | collider111.Size = Vector3.new(1.8,1,1) | |
| 340 | collider111.Shape = "Cylinder" | |
| 341 | local weld111 = Instance.new("Weld", collider111)
| |
| 342 | weld111.Part0 = torso.Parent["Left Arm"] | |
| 343 | weld111.Part1 = collider111 | |
| 344 | weld111.C0 = CFrame.Angles(0, 0, 80) | |
| 345 | collider111.TopSurface = "Smooth" | |
| 346 | collider111.BottomSurface = "Smooth" | |
| 347 | collider111.formFactor = "Symmetric" | |
| 348 | glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
| 349 | glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
| 350 | collider111.Transparency = 1 | |
| 351 | end | |
| 352 | ----------------- | |
| 353 | local sensoring = Instance.new("Part", torso)
| |
| 354 | sensoring.Size = Vector3.new(1.2,1.1,0.8) | |
| 355 | sensoring.CanCollide = false | |
| 356 | sensoring.Position = torso.Position | |
| 357 | local welder = Instance.new("Weld", sensoring)
| |
| 358 | welder.Part0 = torso | |
| 359 | welder.Part1 = sensoring | |
| 360 | welder.C0 = welder.C0 * CFrame.new(0,0,1.05) | |
| 361 | sensoring.Transparency = 1 | |
| 362 | ----------------- | |
| 363 | local sensoring1 = Instance.new("Part", torso)
| |
| 364 | sensoring1.Size = Vector3.new(1.2,1.1,0.8) | |
| 365 | sensoring1.CanCollide = false | |
| 366 | sensoring1.Position = torso.Position | |
| 367 | local welder1 = Instance.new("Weld", sensoring)
| |
| 368 | welder1.Part0 = torso | |
| 369 | welder1.Part1 = sensoring1 | |
| 370 | welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05) | |
| 371 | sensoring1.Transparency = 1 | |
| 372 | local function touch() | |
| 373 | if not using then | |
| 374 | using = true | |
| 375 | local Math = math.random(1,4) | |
| 376 | if Math == 1 then | |
| 377 | hit:Play() | |
| 378 | end | |
| 379 | if Math == 2 then | |
| 380 | hit1:Play() | |
| 381 | end | |
| 382 | if Math == 3 then | |
| 383 | hit2:Play() | |
| 384 | end | |
| 385 | if Math == 4 then | |
| 386 | hit3:Play() | |
| 387 | end | |
| 388 | wait(0.1) | |
| 389 | using = false | |
| 390 | end | |
| 391 | end | |
| 392 | sensoring.Touched:connect(touch) | |
| 393 | sensoring1.Touched:connect(touch) | |
| 394 | if part.Name == "Head" then | |
| 395 | local hed = Instance.new("Sound", torso)
| |
| 396 | hed.SoundId = "rbxassetid://147936251" | |
| 397 | hed.Volume = 5 | |
| 398 | hed:Play() | |
| 399 | hum.Health = 0.00001 | |
| 400 | for i,v in pairs(torso.Parent:GetChildren()) do | |
| 401 | if v.ClassName == "Hat" or v.ClassName == "Accessory" then | |
| 402 | v:destroy() | |
| 403 | end | |
| 404 | end | |
| 405 | for i,v in pairs(torso.Parent.Head:GetChildren()) do | |
| 406 | if v.ClassName == "Decal" then | |
| 407 | v:destroy() | |
| 408 | end | |
| 409 | end | |
| 410 | torso.Parent.Head.Transparency = 1 | |
| 411 | wait(3) | |
| 412 | hum.Health = 0 | |
| 413 | end | |
| 414 | while true do | |
| 415 | wait(0.3) | |
| 416 | hum.PlatformStand = true | |
| 417 | end | |
| 418 | ||
| 419 | --di ent | |
| 420 | end | |
| 421 | end | |
| 422 | end | |
| 423 | missle.Touched:connect(kill) | |
| 424 | for i = 1,2 do | |
| 425 | wait() | |
| 426 | weld.C0 = weld.C0 * CFrame.Angles(0,0,-0.07) | |
| 427 | rhandweld.C0 = rhandweld.C0 * CFrame.Angles(0,0,-0.07) | |
| 428 | end | |
| 429 | shooting = false | |
| 430 | wait(3) | |
| 431 | shotsound:destroy() | |
| 432 | end | |
| 433 | end | |
| 434 | mouse.Button1Down:connect(shoot) | |
| 435 | function ragdoll() | |
| 436 | game.Players.LocalPlayer.Character.Archivable = true | |
| 437 | clone = game.Players.LocalPlayer.Character:Clone() | |
| 438 | clone.Parent = workspace | |
| 439 | for i,v in pairs(clone:GetChildren()) do | |
| 440 | if v.ClassName == "Script" or v.ClassName == "LocalScript" then | |
| 441 | v:destroy() | |
| 442 | end | |
| 443 | for i,p in pairs(v:GetChildren()) do | |
| 444 | if p.ClassName == "Weld" or p.ClassName == "Motor6D" or p.ClassName == "BodyVelocity" then | |
| 445 | p:destroy() | |
| 446 | end | |
| 447 | end | |
| 448 | end | |
| 449 | for i,t in pairs(game.Players.LocalPlayer.Character:GetChildren()) do | |
| 450 | if t.ClassName == "Accessory" or t.ClassName == "ForceField" then | |
| 451 | t:destroy() | |
| 452 | end | |
| 453 | end | |
| 454 | vel = Instance.new("BodyVelocity", clone.Torso)
| |
| 455 | vel.Velocity = clone.Torso.CFrame.lookVector * -5 | |
| 456 | vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
| 457 | clone.Head.face.Texture = "http://www.roblox.com/asset/?id=161061608" | |
| 458 | using = false | |
| 459 | hit = Instance.new("Sound", clone.Torso)
| |
| 460 | hit.SoundId = "rbxassetid://260430060" | |
| 461 | hit.Volume = 5 | |
| 462 | hit1 = Instance.new("Sound", clone.Torso)
| |
| 463 | hit1.SoundId = "rbxassetid://138087186" | |
| 464 | hit1.Volume = 5 | |
| 465 | hit2 = Instance.new("Sound", clone.Torso)
| |
| 466 | hit2.SoundId = "rbxassetid://131237241" | |
| 467 | hit2.Volume = 5 | |
| 468 | hit3 = Instance.new("Sound", clone.Torso)
| |
| 469 | hit3.SoundId = "rbxassetid://278062209" | |
| 470 | hit3.Volume = 5 | |
| 471 | hit3.TimePosition = 0.33 | |
| 472 | ded = Instance.new("Sound", clone.Torso)
| |
| 473 | ded.SoundId = "rbxassetid://418892870" | |
| 474 | ded.Volume = 5 | |
| 475 | local leftarm = clone:findFirstChild("Left Arm")
| |
| 476 | local rightrm = clone:findFirstChild("Right Arm")
| |
| 477 | local leftleg = clone:findFirstChild("Left Leg")
| |
| 478 | local rightleg = clone:findFirstChild("Right Leg")
| |
| 479 | local head = clone:findFirstChild("Head")
| |
| 480 | local welding = Instance.new("Weld", clone.Torso)
| |
| 481 | welding.Part0 = clone.Torso | |
| 482 | welding.Part1 = head | |
| 483 | welding.C0 = welding.C0 * CFrame.new(0,1.5,0) | |
| 484 | for i, g in pairs(game.Players.LocalPlayer.Character:GetChildren()) do | |
| 485 | if g.ClassName == "Part" then | |
| 486 | g:destroy() | |
| 487 | end | |
| 488 | end | |
| 489 | for i, h in pairs(game.Players.LocalPlayer.Character:GetChildren()) do | |
| 490 | if h.ClassName == "Accesory" then | |
| 491 | h:destroy() | |
| 492 | end | |
| 493 | end | |
| 494 | game.Workspace.CurrentCamera.CameraSubject = head | |
| 495 | if leftleg ~= nil then | |
| 496 | local glue = Instance.new("Glue", clone.Torso)
| |
| 497 | glue.Part0 = clone.Torso | |
| 498 | glue.Part1 = leftleg | |
| 499 | glue.Name = "Left leg" | |
| 500 | local collider = Instance.new("Part", leftleg)
| |
| 501 | collider.Position = Vector3.new(0,999,0) | |
| 502 | collider.Size = Vector3.new(1.7, 1, 1) | |
| 503 | collider.Shape = "Cylinder" | |
| 504 | local weld = Instance.new("Weld", collider)
| |
| 505 | weld.Part0 = leftleg | |
| 506 | weld.Part1 = collider | |
| 507 | weld.C0 = CFrame.Angles(0, 0, 80) | |
| 508 | collider.TopSurface = "Smooth" | |
| 509 | collider.BottomSurface = "Smooth" | |
| 510 | collider.formFactor = "Symmetric" | |
| 511 | glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 512 | glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 513 | collider.Transparency = 1 | |
| 514 | end | |
| 515 | ------------ | |
| 516 | if rightleg ~= nil then | |
| 517 | local glue1 = Instance.new("Glue", clone.Torso)
| |
| 518 | glue1.Part0 = clone.Torso | |
| 519 | glue1.Part1 = rightleg | |
| 520 | glue1.Name = "Right leg" | |
| 521 | local collider1 = Instance.new("Part", rightleg)
| |
| 522 | collider1.Position = Vector3.new(0,999,0) | |
| 523 | collider1.Size = Vector3.new(1.7, 1, 1) | |
| 524 | collider1.Shape = "Cylinder" | |
| 525 | local weld1 = Instance.new("Weld", collider1)
| |
| 526 | weld1.Part0 = rightleg | |
| 527 | weld1.Part1 = collider1 | |
| 528 | weld1.C0 = CFrame.Angles(0, 0, 80) | |
| 529 | collider1.TopSurface = "Smooth" | |
| 530 | collider1.BottomSurface = "Smooth" | |
| 531 | collider1.formFactor = "Symmetric" | |
| 532 | glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 533 | glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 534 | collider1.Transparency = 1 | |
| 535 | end | |
| 536 | ------------ | |
| 537 | if rightrm ~= nil then | |
| 538 | local glue11 = Instance.new("Glue", clone.Torso)
| |
| 539 | glue11.Part0 = clone.Torso | |
| 540 | glue11.Part1 = rightrm | |
| 541 | glue11.Name = "Right shoulder" | |
| 542 | local collider11 = Instance.new("Part", rightrm)
| |
| 543 | collider11.Position = Vector3.new(0,9999,0) | |
| 544 | collider11.Size = Vector3.new(1.8,1,1) | |
| 545 | collider11.Shape = "Cylinder" | |
| 546 | local weld11 = Instance.new("Weld", collider11)
| |
| 547 | weld11.Part0 = rightrm | |
| 548 | weld11.Part1 = collider11 | |
| 549 | weld11.C0 = CFrame.Angles(0, 0, 80) | |
| 550 | collider11.TopSurface = "Smooth" | |
| 551 | collider11.BottomSurface = "Smooth" | |
| 552 | collider11.formFactor = "Symmetric" | |
| 553 | glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
| 554 | glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
| 555 | collider11.Transparency = 1 | |
| 556 | end | |
| 557 | ------------ | |
| 558 | if leftarm ~= nil then | |
| 559 | local glue111 = Instance.new("Glue", clone.Torso)
| |
| 560 | glue111.Part0 = clone.Torso | |
| 561 | glue111.Part1 = leftarm | |
| 562 | glue111.Name = "Left shoulder" | |
| 563 | local collider111 = Instance.new("Part", leftarm)
| |
| 564 | collider111.Position = Vector3.new(0,9999,0) | |
| 565 | collider111.Size = Vector3.new(1.8,1,1) | |
| 566 | collider111.Shape = "Cylinder" | |
| 567 | local weld111 = Instance.new("Weld", collider111)
| |
| 568 | weld111.Part0 = leftarm | |
| 569 | weld111.Part1 = collider111 | |
| 570 | weld111.C0 = CFrame.Angles(0, 0, 80) | |
| 571 | collider111.TopSurface = "Smooth" | |
| 572 | collider111.BottomSurface = "Smooth" | |
| 573 | collider111.formFactor = "Symmetric" | |
| 574 | glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
| 575 | glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
| 576 | collider111.Transparency = 1 | |
| 577 | ---------------- | |
| 578 | sensoring = Instance.new("Part", clone.Torso)
| |
| 579 | sensoring.Size = Vector3.new(1.2,1.1,0.8) | |
| 580 | sensoring.CanCollide = false | |
| 581 | sensoring.Position = clone.Torso.Position | |
| 582 | local welder = Instance.new("Weld", sensoring)
| |
| 583 | welder.Part0 = clone.Torso | |
| 584 | welder.Part1 = sensoring | |
| 585 | welder.C0 = welder.C0 * CFrame.new(0,0,1.05) | |
| 586 | sensoring.Transparency = 1 | |
| 587 | ----------------- | |
| 588 | sensoring1 = Instance.new("Part", clone.Torso)
| |
| 589 | sensoring1.Size = Vector3.new(1.2,1.1,0.8) | |
| 590 | sensoring1.CanCollide = false | |
| 591 | sensoring1.Position = clone.Torso.Position | |
| 592 | local welder1 = Instance.new("Weld", sensoring)
| |
| 593 | welder1.Part0 = clone.Torso | |
| 594 | welder1.Part1 = sensoring1 | |
| 595 | welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05) | |
| 596 | sensoring1.Transparency = 1 | |
| 597 | end | |
| 598 | clone.Name = game.Players.LocalPlayer.Character.Name.." (DEAD)" | |
| 599 | ded:Play() | |
| 600 | vel:destroy() | |
| 601 | wait(0.5) | |
| 602 | local function touch() | |
| 603 | if not using then | |
| 604 | using = true | |
| 605 | local Math = math.random(1,4) | |
| 606 | if Math == 1 then | |
| 607 | hit:Play() | |
| 608 | end | |
| 609 | if Math == 2 then | |
| 610 | hit1:Play() | |
| 611 | end | |
| 612 | if Math == 3 then | |
| 613 | hit2:Play() | |
| 614 | end | |
| 615 | if Math == 4 then | |
| 616 | hit3:Play() | |
| 617 | end | |
| 618 | wait(0.1) | |
| 619 | using = false | |
| 620 | end | |
| 621 | end | |
| 622 | sensoring.Touched:connect(touch) | |
| 623 | sensoring1.Touched:connect(touch) | |
| 624 | wait(4.47) | |
| 625 | hit1.Volume = 0 | |
| 626 | hit2.Volume = 0 | |
| 627 | hit3.Volume = 0 | |
| 628 | hit.Volume = 0 | |
| 629 | end | |
| 630 | ||
| 631 | game.Players.LocalPlayer.Character.Humanoid.Died:connect(ragdoll) | |
| 632 | ||
| 633 | --di ent |