SHOW:
|
|
- or go back to the newest paste.
| 1 | --just put this on the top of a script and boom 89% works | |
| 2 | --note this does not work on big scripts | |
| 3 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 4 | local Player,game,owner = owner,game | |
| 5 | local RealPlayer = Player | |
| 6 | do | |
| 7 | local rp = RealPlayer | |
| 8 | script.Parent = rp.Character | |
| 9 | ||
| 10 | --RemoteEvent for communicating | |
| 11 | local Event = Instance.new("RemoteEvent")
| |
| 12 | Event.Name = "UserInput_Event" | |
| 13 | ||
| 14 | --Fake event to make stuff like Mouse.KeyDown work | |
| 15 | local function fakeEvent() | |
| 16 | local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
| |
| 17 | t.connect = t.Connect | |
| 18 | return t | |
| 19 | end | |
| 20 | ||
| 21 | --Creating fake input objects with fake variables | |
| 22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
| |
| 23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 26 | end} | |
| 27 | --Merged 2 functions into one by checking amount of arguments | |
| 28 | CAS.UnbindAction = CAS.BindAction | |
| 29 | ||
| 30 | --This function will trigger the events that have been :Connect()'ed | |
| 31 | local function te(self,ev,...) | |
| 32 | local t = m[ev] | |
| 33 | if t and t._fakeEvent then | |
| 34 | for _,f in pairs(t.Functions) do | |
| 35 | f(...) | |
| 36 | end | |
| 37 | end | |
| 38 | end | |
| 39 | m.TrigEvent = te | |
| 40 | UIS.TrigEvent = te | |
| 41 | ||
| 42 | Event.OnServerEvent:Connect(function(plr,io) | |
| 43 | if plr~=rp then return end | |
| 44 | m.Target = io.Target | |
| 45 | m.Hit = io.Hit | |
| 46 | if not io.isMouse then | |
| 47 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 48 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 49 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
| 50 | end | |
| 51 | for _,t in pairs(CAS.Actions) do | |
| 52 | for _,k in pairs(t.Keys) do | |
| 53 | if k==io.KeyCode then | |
| 54 | t.Function(t.Name,io.UserInputState,io) | |
| 55 | end | |
| 56 | end | |
| 57 | end | |
| 58 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 59 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 60 | end | |
| 61 | end) | |
| 62 | Event.Parent = NLS([==[ | |
| 63 | local Player = game:GetService("Players").LocalPlayer
| |
| 64 | local Event = script:WaitForChild("UserInput_Event")
| |
| 65 | ||
| 66 | local Mouse = Player:GetMouse() | |
| 67 | local UIS = game:GetService("UserInputService")
| |
| 68 | local input = function(io,a) | |
| 69 | if a then return end | |
| 70 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 71 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 72 | end | |
| 73 | UIS.InputBegan:Connect(input) | |
| 74 | UIS.InputEnded:Connect(input) | |
| 75 | ||
| 76 | local h,t | |
| 77 | --Give the server mouse data 30 times every second, but only if the values changed | |
| 78 | --If player is not moving their mouse, client won't fire events | |
| 79 | while wait(1/30) do | |
| 80 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 81 | h,t=Mouse.Hit,Mouse.Target | |
| 82 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 83 | end | |
| 84 | end]==],Player.Character) | |
| 85 | ||
| 86 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 87 | --Real game object | |
| 88 | local _rg = game | |
| 89 | ||
| 90 | --Metatable for fake service | |
| 91 | local fsmt = {
| |
| 92 | __index = function(self,k) | |
| 93 | local s = rawget(self,"_RealService") | |
| 94 | if s then return s[k] end | |
| 95 | end, | |
| 96 | __newindex = function(self,k,v) | |
| 97 | local s = rawget(self,"_RealService") | |
| 98 | if s then s[k]=v end | |
| 99 | end, | |
| 100 | __call = function(self,...) | |
| 101 | local s = rawget(self,"_RealService") | |
| 102 | if s then return s(...) end | |
| 103 | end | |
| 104 | } | |
| 105 | local function FakeService(t,RealService) | |
| 106 | t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService | |
| 107 | return setmetatable(t,fsmt) | |
| 108 | end | |
| 109 | ||
| 110 | --Fake game object | |
| 111 | local g = {
| |
| 112 | GetService = function(self,s) | |
| 113 | return self[s] | |
| 114 | end, | |
| 115 | Players = FakeService({
| |
| 116 | LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
| |
| 117 | },"Players"), | |
| 118 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 119 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 120 | } | |
| 121 | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) | |
| 122 | g.service = g.GetService | |
| 123 | ||
| 124 | g.RunService = FakeService({
| |
| 125 | RenderStepped = _rg:GetService("RunService").Heartbeat,
| |
| 126 | BindToRenderStep = function(self,name,_,fun) | |
| 127 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 128 | end, | |
| 129 | UnbindFromRenderStep = function(self,name) | |
| 130 | self._btrs[name]:Disconnect() | |
| 131 | end, | |
| 132 | },"RunService") | |
| 133 | ||
| 134 | setmetatable(g,{
| |
| 135 | __index=function(self,s) | |
| 136 | return _rg:GetService(s) or typeof(_rg[s])=="function" | |
| 137 | and function(_,...)return _rg[s](_rg,...)end or _rg[s] | |
| 138 | end, | |
| 139 | __newindex = fsmt.__newindex, | |
| 140 | __call = fsmt.__call | |
| 141 | }) | |
| 142 | --Changing owner to fake player object to support owner:GetMouse() | |
| 143 | game,owner = g,g.Players.LocalPlayer | |
| 144 | end | |
| 145 | ||
| 146 | ||
| 147 | --3DG | |
| 148 | --three dimensional grapples | |
| 149 | function clerp(c1,c2,al) | |
| 150 | local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
| |
| 151 | local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
| |
| 152 | for i,v in pairs(com1) do | |
| 153 | com1[i] = v+(com2[i]-v)*al | |
| 154 | end | |
| 155 | return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1))) | |
| 156 | end | |
| 157 | ||
| 158 | plr = game:service'Players'.LocalPlayer | |
| 159 | plrgui = plr.PlayerGui | |
| 160 | char = plr.Character | |
| 161 | mouse = plr:GetMouse() | |
| 162 | humanoid = char:findFirstChild("Humanoid")
| |
| 163 | torso = char:findFirstChild("Torso")
| |
| 164 | head = char.Head | |
| 165 | ra = char:findFirstChild("Right Arm")
| |
| 166 | la = char:findFirstChild("Left Arm")
| |
| 167 | rl = char:findFirstChild("Right Leg")
| |
| 168 | ll = char:findFirstChild("Left Leg")
| |
| 169 | rs = torso:findFirstChild("Right Shoulder")
| |
| 170 | ls = torso:findFirstChild("Left Shoulder")
| |
| 171 | rh = torso:findFirstChild("Right Hip")
| |
| 172 | lh = torso:findFirstChild("Left Hip")
| |
| 173 | neck = torso:findFirstChild("Neck")
| |
| 174 | rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
| |
| 175 | rootpart = char:findFirstChild("HumanoidRootPart")
| |
| 176 | camera = workspace.CurrentCamera | |
| 177 | anim = char:findFirstChild("Animate")
| |
| 178 | if anim then | |
| 179 | anim:Destroy() | |
| 180 | end | |
| 181 | ||
| 182 | local lal = Instance.new('Sound', head)
| |
| 183 | lal.SoundId = "rbxassetid://145048800" | |
| 184 | lal.Volume = 1 | |
| 185 | lal:play() | |
| 186 | game:service'Debris':AddItem(lal, 8) | |
| 187 | ||
| 188 | local rm = Instance.new("Weld", torso)
| |
| 189 | rm.C0 = CFrame.new(1.5, 0.5, 0) | |
| 190 | rm.C1 = CFrame.new(0, 0.5, 0) | |
| 191 | rm.Part0 = torso | |
| 192 | rm.Part1 = ra | |
| 193 | rm.Name = 'Right Shoulder' | |
| 194 | ||
| 195 | local lm = Instance.new("Weld", torso)
| |
| 196 | lm.C0 = CFrame.new(-1.5, 0.5, 0) | |
| 197 | lm.C1 = CFrame.new(0, 0.5, 0) | |
| 198 | lm.Part0 = torso | |
| 199 | lm.Part1 = la | |
| 200 | lm.Name = 'Left Shoulder' | |
| 201 | ||
| 202 | local rlegm = Instance.new("Weld", torso)
| |
| 203 | rlegm.C0 = CFrame.new(0.5, -1, 0) | |
| 204 | rlegm.C1 = CFrame.new(0, 1, 0) | |
| 205 | rlegm.Part0 = torso | |
| 206 | rlegm.Part1 = rl | |
| 207 | ||
| 208 | local llegm = Instance.new("Weld", torso)
| |
| 209 | llegm.C0 = CFrame.new(-0.5, -1, 0) | |
| 210 | llegm.C1 = CFrame.new(0, 1, 0) | |
| 211 | llegm.Part0 = torso | |
| 212 | llegm.Part1 = ll | |
| 213 | ||
| 214 | rj.C0 = CFrame.new() | |
| 215 | rj.C1 = CFrame.new() | |
| 216 | ||
| 217 | neck.C0 = CFrame.new(0, 1, 0) | |
| 218 | neck.C1 = CFrame.new(0, -0.5, 0) | |
| 219 | ||
| 220 | ||
| 221 | local speed = 0.3 | |
| 222 | local angle = 0 | |
| 223 | local anglespeed = 1 | |
| 224 | rsc0 = rm.C0 | |
| 225 | lsc0 = lm.C0 | |
| 226 | llc0 = llegm.C0 | |
| 227 | rlc0 = rlegm.C0 | |
| 228 | rootc0 = rj.C0 | |
| 229 | neckc0 = neck.C0 | |
| 230 | ||
| 231 | model = Instance.new('Model', char)
| |
| 232 | model.Name = '3DG' | |
| 233 | function Weld(part0,part1,c1,c0) | |
| 234 | local w = Instance.new('Weld', model)
| |
| 235 | w.Part0 = part0 | |
| 236 | w.Part1 = part1 | |
| 237 | w.C0 = c0 or CFrame.new() | |
| 238 | w.C1 = c1 or CFrame.new() | |
| 239 | end | |
| 240 | ||
| 241 | local BasePart = Instance.new('Part')
| |
| 242 | BasePart.FormFactor = 'Custom' | |
| 243 | BasePart.Material = 'Neon' | |
| 244 | BasePart.CanCollide = false | |
| 245 | BasePart.Locked = true | |
| 246 | BasePart.TopSurface = 10 | |
| 247 | BasePart.BottomSurface = 10 | |
| 248 | BasePart.LeftSurface = 10 | |
| 249 | BasePart.RightSurface = 10 | |
| 250 | BasePart.FrontSurface = 10 | |
| 251 | BasePart.BackSurface = 10 | |
| 252 | BasePart:breakJoints() | |
| 253 | ||
| 254 | ||
| 255 | for i = 1,2 do | |
| 256 | local strap = BasePart:clone() | |
| 257 | strap.Size = Vector3.new(1.025,.2,1.025) | |
| 258 | strap.Parent = model | |
| 259 | strap.BrickColor = BrickColor.new() | |
| 260 | strap:BreakJoints() | |
| 261 | Weld(strap, la, CFrame.new(0, .1 - i/3,0)) | |
| 262 | end | |
| 263 | ||
| 264 | for i = 1,2 do | |
| 265 | local strap = BasePart:clone() | |
| 266 | strap.Size = Vector3.new(1.025,.2,1.025) | |
| 267 | strap.Parent = model | |
| 268 | strap.BrickColor = BrickColor.new() | |
| 269 | strap:BreakJoints() | |
| 270 | Weld(strap, ra, CFrame.new(0, .1 - i/3,0)) | |
| 271 | end | |
| 272 | ||
| 273 | local ropeStart = BasePart:clone() | |
| 274 | ropeStart.Size = Vector3.new(.2,1.75,.2) | |
| 275 | ropeStart.Parent = model | |
| 276 | ropeStart.BrickColor = BrickColor.new() | |
| 277 | ropeStart:BreakJoints() | |
| 278 | Weld(ropeStart, ra, CFrame.new(-.45, -.5, 0)) | |
| 279 | local ropeStart2 = BasePart:clone() | |
| 280 | ropeStart2.Size = Vector3.new(.2,1.75,.2) | |
| 281 | ropeStart2.Parent = model | |
| 282 | ropeStart2.BrickColor = BrickColor.new() | |
| 283 | ropeStart2:BreakJoints() | |
| 284 | Weld(ropeStart2, la, CFrame.new(.45, -.5, 0)) | |
| 285 | ||
| 286 | local ropeCont = BasePart:clone() | |
| 287 | ropeCont.Size = Vector3.new(.8,.2,.8) | |
| 288 | ropeCont.Parent = model | |
| 289 | ropeCont.BrickColor = BrickColor.new(199) | |
| 290 | ropeCont:BreakJoints() | |
| 291 | Instance.new('CylinderMesh', ropeCont)
| |
| 292 | Weld(ropeCont, la, CFrame.new(.5, .05, 0), CFrame.Angles(math.pi/2, math.pi/2, 0)) | |
| 293 | local ropeCont2 = BasePart:clone() | |
| 294 | ropeCont2.Size = Vector3.new(.8,.2,.8) | |
| 295 | ropeCont2.Parent = model | |
| 296 | ropeCont2.BrickColor = BrickColor.new(199) | |
| 297 | ropeCont2:BreakJoints() | |
| 298 | Instance.new('CylinderMesh', ropeCont2)
| |
| 299 | Weld(ropeCont2, ra, CFrame.new(-.5, .05, 0), CFrame.Angles(math.pi/2, math.pi/2, 0)) | |
| 300 | ||
| 301 | local GasTank = BasePart:clone() | |
| 302 | GasTank.Size = Vector3.new(.8,1.4,.8) | |
| 303 | GasTank.Parent = model | |
| 304 | GasTank.BrickColor = BrickColor.new(194) | |
| 305 | GasTank:BreakJoints() | |
| 306 | Instance.new('SpecialMesh', GasTank)
| |
| 307 | Weld(GasTank, ra, CFrame.new(0, -.25, .5)) | |
| 308 | local GasTank2 = BasePart:clone() | |
| 309 | GasTank2.Size = Vector3.new(.8,1.4,.8) | |
| 310 | GasTank2.Parent = model | |
| 311 | GasTank2.BrickColor = BrickColor.new(194) | |
| 312 | GasTank2:BreakJoints() | |
| 313 | Instance.new('SpecialMesh', GasTank2)
| |
| 314 | Weld(GasTank2, la, CFrame.new(0, -.25, .5)) | |
| 315 | ||
| 316 | local pa = BasePart:clone() | |
| 317 | pa.BrickColor = BrickColor.new() | |
| 318 | pa.Anchored = true | |
| 319 | pa.Size = Vector3.new(.5,1,.5) | |
| 320 | local special = Instance.new('SpecialMesh', pa)
| |
| 321 | special.MeshId = "rbxassetid://1033714" | |
| 322 | special.Scale = Vector3.new(.25,2,.25) | |
| 323 | local ropePA = BasePart:clone() | |
| 324 | ropePA.Parent = pa | |
| 325 | ropePA.Anchored = true | |
| 326 | ropePA.BrickColor = BrickColor.new'White' | |
| 327 | Instance.new('CylinderMesh', ropePA).Scale = Vector3.new(.25,1,.25)
| |
| 328 | ||
| 329 | local pa2 = BasePart:clone() | |
| 330 | pa2.BrickColor = BrickColor.new() | |
| 331 | pa2.Anchored = true | |
| 332 | pa2.Size = Vector3.new(.5,1,.5) | |
| 333 | local special = Instance.new('SpecialMesh', pa2)
| |
| 334 | special.MeshId = "rbxassetid://1033714" | |
| 335 | special.Scale = Vector3.new(.25,2,.25) | |
| 336 | local ropePA2 = BasePart:clone() | |
| 337 | ropePA2.Parent = pa2 | |
| 338 | ropePA2.Anchored = true | |
| 339 | ropePA2.BrickColor = BrickColor.new'White' | |
| 340 | Instance.new('CylinderMesh', ropePA2).Scale = Vector3.new(.25,1,.25)
| |
| 341 | ||
| 342 | local pa3 = BasePart:clone() | |
| 343 | pa3.Transparency = 1 | |
| 344 | pa3.Anchored = true | |
| 345 | pa3.Size = Vector3.new(2,2,2) | |
| 346 | ||
| 347 | local torso3 = Instance.new('Part', char)
| |
| 348 | torso3.Name = 'FakeTorsoForStuff' | |
| 349 | torso3.Size = torso.Size | |
| 350 | torso3.Transparency = 1 | |
| 351 | torso3:breakJoints() | |
| 352 | Weld(torso3, torso) | |
| 353 | ||
| 354 | Instance.new('PointLight', torso)
| |
| 355 | ||
| 356 | local jumpmode | |
| 357 | ||
| 358 | local SGui = Instance.new('ScreenGui', plr.PlayerGui)
| |
| 359 | local JumpButton = Instance.new('TextButton', SGui)
| |
| 360 | JumpButton.BackgroundColor = BrickColor.new('Dark stone grey')
| |
| 361 | JumpButton.BorderSizePixel = 4 | |
| 362 | JumpButton.TextColor3 = Color3.new(1,1,1) | |
| 363 | JumpButton.BorderColor3 = Color3.new() | |
| 364 | JumpButton.TextStrokeTransparency = .5 | |
| 365 | JumpButton.FontSize = 'Size12' | |
| 366 | JumpButton.Text = 'Thrust up when grappled' | |
| 367 | JumpButton.Size = UDim2.new(0, 250, 0, 50) | |
| 368 | JumpButton.Position = UDim2.new(1, -250, 1, -50) | |
| 369 | local OnOff = Instance.new('Frame', JumpButton)
| |
| 370 | OnOff.BackgroundColor3 = Color3.new() | |
| 371 | OnOff.BorderSizePixel = 0 | |
| 372 | OnOff.Size = UDim2.new(.8, 0, 0, 5) | |
| 373 | OnOff.Position = UDim2.new(.1, 0, 1, -10) | |
| 374 | JumpButton.MouseButton1Down:connect(function() | |
| 375 | jumpmode = not jumpmode | |
| 376 | if jumpmode then | |
| 377 | OnOff.BackgroundColor3 = Color3.new(0,1,0) | |
| 378 | else | |
| 379 | OnOff.BackgroundColor3 = Color3.new() | |
| 380 | end | |
| 381 | end) | |
| 382 | ||
| 383 | ||
| 384 | ||
| 385 | local bodygyro = Instance.new('BodyGyro', torso)
| |
| 386 | bodygyro.maxTorque = Vector3.new(14e16,14e16,14e16) | |
| 387 | bodygyro.P = 10000 | |
| 388 | ||
| 389 | ro=Instance.new("RocketPropulsion",rootpart)
| |
| 390 | ro.Name = 'RockatPropoolsun' | |
| 391 | ro.MaxSpeed=200 | |
| 392 | ro.MaxThrust=8000 | |
| 393 | ro.TurnP = 0 | |
| 394 | ro.MaxTorque=Vector3.new(14e16,14e16,14e16) | |
| 395 | ||
| 396 | ro2=Instance.new("RocketPropulsion",torso)
| |
| 397 | ro2.Name = 'RockatPropoolsun2' | |
| 398 | ro2.MaxSpeed=200 | |
| 399 | ro2.MaxThrust=8000 | |
| 400 | ro2.TurnP = 0 | |
| 401 | ro2.MaxTorque=Vector3.new(14e16,14e16,14e16) | |
| 402 | local run | |
| 403 | mouse.KeyDown:connect(function(k) | |
| 404 | if k:byte() == 48 then | |
| 405 | run = not run | |
| 406 | if run then | |
| 407 | humanoid.WalkSpeed = 22 | |
| 408 | else | |
| 409 | humanoid.WalkSpeed = 16 | |
| 410 | end | |
| 411 | end | |
| 412 | if k:byte() == 32 then | |
| 413 | if Grapple1 or Grapple2 then | |
| 414 | wait() | |
| 415 | humanoid.PlatformStand = true | |
| 416 | rlegm.C0 = rlc0 * CFrame.new(0, .5, -.65) * CFrame.Angles(-math.pi/8, 0, .1) | |
| 417 | llegm.C0 = llc0 * CFrame.new(0, .5, -.65) * CFrame.Angles(-math.pi/8, 0, -.1) | |
| 418 | if pa3.Parent ~= nil then | |
| 419 | ro3:Fire() | |
| 420 | end | |
| 421 | if Grapple1 then | |
| 422 | ro:Fire() | |
| 423 | end | |
| 424 | if Grapple2 then | |
| 425 | ro2:Fire() | |
| 426 | end | |
| 427 | end | |
| 428 | end | |
| 429 | if k=="q" then | |
| 430 | local sound = Instance.new('Sound', head)
| |
| 431 | sound.SoundId = "rbxassetid://160248505" | |
| 432 | sound.Pitch = 3+math.random()/3 | |
| 433 | sound.Volume = .8 | |
| 434 | sound:play() | |
| 435 | game:service'Debris':AddItem(sound,4) | |
| 436 | lm.Parent = torso | |
| 437 | pa.CFrame = la.CFrame | |
| 438 | local grapplepos = pa.Position | |
| 439 | local grapplevelocity = (mouse.Hit.p - grapplepos).unit*50 | |
| 440 | local lastgrapplepos = pa.Position | |
| 441 | while wait() do | |
| 442 | lastgrapplepos = grapplepos | |
| 443 | grapplepos = grapplepos + grapplevelocity | |
| 444 | local RayCast = Ray.new(lastgrapplepos, (grapplepos - lastgrapplepos)) | |
| 445 | local hit, hitpos = workspace:FindPartOnRay(RayCast, char) | |
| 446 | if (torso.Position - pa.Position).magnitude > 900 then | |
| 447 | pa.Parent = nil | |
| 448 | break | |
| 449 | end | |
| 450 | pa.Anchored = true | |
| 451 | pa.CFrame = CFrame.new(grapplepos, grapplepos+grapplevelocity) * CFrame.Angles(math.pi/2, 0, 0) | |
| 452 | pa.Parent = char | |
| 453 | if hit then | |
| 454 | local rotX,rotY,rotZ = pa.CFrame:toEulerAnglesXYZ() | |
| 455 | local sound = Instance.new('Sound', head)
| |
| 456 | sound.SoundId = "rbxassetid://146466021" | |
| 457 | sound.Pitch = 1.2+math.random()/3 | |
| 458 | sound.Volume = .25 | |
| 459 | sound:play() | |
| 460 | game:service'Debris':AddItem(sound,4) | |
| 461 | pa.Parent = char | |
| 462 | pa.CFrame=CFrame.new(hitpos.x, hitpos.y, hitpos.z)*CFrame.Angles(rotX,rotY,rotZ)*CFrame.Angles(math.pi,0,0) | |
| 463 | ro.Target=pa | |
| 464 | lm.Parent = torso | |
| 465 | local ray = Ray.new(rootpart.Position, Vector3.new(0, -6, 0)) | |
| 466 | local hitz, enz = workspace:FindPartOnRay(ray, char) | |
| 467 | local hum = hit and hit.Parent and hit.Parent:findFirstChild'Humanoid' | |
| 468 | if hum then | |
| 469 | hum:TakeDamage(math.random(7,11)) | |
| 470 | end | |
| 471 | local hum = hit and hit.Parent and hit.Parent.Parent and hit.Parent.Parent:findFirstChild'Humanoid' | |
| 472 | if hum then | |
| 473 | hum:TakeDamage(math.random(7,11)) | |
| 474 | end | |
| 475 | if pa.Parent ~= nil and humanoid.PlatformStand or not (hitz and hitz.CanCollide) then | |
| 476 | ro:Fire() | |
| 477 | if jumpmode then | |
| 478 | humanoid.Jump = true | |
| 479 | end | |
| 480 | end | |
| 481 | Gweld = Instance.new("Weld", char)
| |
| 482 | Gweld.C0 = hit.CFrame:toObjectSpace(pa.CFrame) | |
| 483 | Gweld.Part0 = hit | |
| 484 | Gweld.Part1 = pa | |
| 485 | pa.Anchored = false | |
| 486 | Grapple1Hit = hit | |
| 487 | Grapple1 = true | |
| 488 | break | |
| 489 | end | |
| 490 | pa.Anchored = true | |
| 491 | pa.CFrame = CFrame.new(grapplepos, grapplepos+grapplevelocity) * CFrame.Angles(math.pi/2, 0, 0) | |
| 492 | end | |
| 493 | end | |
| 494 | if k=="e" then | |
| 495 | local sound = Instance.new('Sound', head)
| |
| 496 | sound.SoundId = "rbxassetid://160248505" | |
| 497 | sound.Pitch = 3+math.random()/3 | |
| 498 | sound.Volume = .8 | |
| 499 | sound:play() | |
| 500 | game:service'Debris':AddItem(sound,4) | |
| 501 | pa2.CFrame = ra.CFrame | |
| 502 | rm.Parent = torso | |
| 503 | local grapplepos = pa2.Position | |
| 504 | local grapplevelocity = (mouse.Hit.p - grapplepos).unit*50 | |
| 505 | local lastgrapplepos = pa2.Position | |
| 506 | while wait() do | |
| 507 | lastgrapplepos = grapplepos | |
| 508 | grapplepos = grapplepos + grapplevelocity | |
| 509 | local RayCast = Ray.new(lastgrapplepos, (grapplepos - lastgrapplepos)) | |
| 510 | local hit, hitpos = workspace:FindPartOnRay(RayCast, char) | |
| 511 | if (torso.Position - pa2.Position).magnitude > 900 then | |
| 512 | pa2.Parent = nil | |
| 513 | break | |
| 514 | end | |
| 515 | pa2.Anchored = true | |
| 516 | pa2.CFrame = CFrame.new(grapplepos, grapplepos+grapplevelocity) * CFrame.Angles(math.pi/2, 0, 0) | |
| 517 | pa2.Parent = char | |
| 518 | if hit then | |
| 519 | local rotX,rotY,rotZ = pa2.CFrame:toEulerAnglesXYZ() | |
| 520 | local sound = Instance.new('Sound', head)
| |
| 521 | sound.SoundId = "rbxassetid://146466021" | |
| 522 | sound.Pitch = 1.2+math.random()/3 | |
| 523 | sound.Volume = .25 | |
| 524 | sound:play() | |
| 525 | game:service'Debris':AddItem(sound,4) | |
| 526 | pa2.Parent = char | |
| 527 | pa2.CFrame=CFrame.new(hitpos.x, hitpos.y, hitpos.z)*CFrame.Angles(rotX,rotY,rotZ)*CFrame.Angles(math.pi,0,0) | |
| 528 | ro2.Target=pa2 | |
| 529 | rm.Parent = torso | |
| 530 | local ray = Ray.new(rootpart.Position, Vector3.new(0, -6, 0)) | |
| 531 | local hitz, enz = workspace:FindPartOnRay(ray, char) | |
| 532 | local hum = hit and hit.Parent and hit.Parent:findFirstChild'Humanoid' | |
| 533 | if hum then | |
| 534 | hum:TakeDamage(math.random(7,11)) | |
| 535 | end | |
| 536 | local hum = hit and hit.Parent and hit.Parent.Parent and hit.Parent.Parent:findFirstChild'Humanoid' | |
| 537 | if hum then | |
| 538 | hum:TakeDamage(math.random(7,11)) | |
| 539 | end | |
| 540 | if pa2.Parent ~= nil and humanoid.PlatformStand or not (hitz and hitz.CanCollide) then | |
| 541 | if jumpmode then | |
| 542 | humanoid.Jump = true | |
| 543 | end | |
| 544 | ro2:Fire() | |
| 545 | end | |
| 546 | Gweld2 = Instance.new("Weld", char)
| |
| 547 | Gweld2.C0 = hit.CFrame:toObjectSpace(pa2.CFrame) | |
| 548 | Gweld2.Part0 = hit | |
| 549 | Gweld2.Part1 = pa2 | |
| 550 | pa2.Anchored = false | |
| 551 | Grapple2Hit = hit | |
| 552 | Grapple2 = true | |
| 553 | break | |
| 554 | end | |
| 555 | pa2.Anchored = true | |
| 556 | pa2.CFrame = CFrame.new(grapplepos, grapplepos+grapplevelocity) * CFrame.Angles(math.pi/2, 0, 0) | |
| 557 | end | |
| 558 | end | |
| 559 | end) | |
| 560 | ||
| 561 | mouse.KeyUp:connect(function(k) | |
| 562 | if k=="q" then | |
| 563 | pcall(function() Gweld:remove() end) | |
| 564 | game:service'RunService'.RenderStepped:wait() | |
| 565 | pcall(function() pa.Parent = nil Grapple1 = false end) | |
| 566 | pcall(function() ro:Abort() end) | |
| 567 | game:service'RunService'.RenderStepped:wait() | |
| 568 | pcall(function() ro2.Target=pa2 if Grapple2 and humanoid.PlatformStand or Grapple2 and not hitz then ro2:Fire() end end) | |
| 569 | elseif k=="e" then | |
| 570 | pcall(function() Gweld2:remove() end) | |
| 571 | game:service'RunService'.RenderStepped:wait() | |
| 572 | pcall(function() pa2.Parent = nil Grapple2 = false end) | |
| 573 | pcall(function() ro2:Abort() end) | |
| 574 | game:service'RunService'.RenderStepped:wait() | |
| 575 | pcall(function() ro.Target=pa if Grapple1 and humanoid.PlatformStand or Grapple1 and not hitz then ro:Fire() end end) | |
| 576 | end | |
| 577 | end) | |
| 578 | ||
| 579 | ||
| 580 | local MidPointUsed = false | |
| 581 | local TorsoSmoke = Instance.new('Smoke', torso)
| |
| 582 | ||
| 583 | ||
| 584 | game:service'RunService'.RenderStepped:connect(function() | |
| 585 | angle = (angle % 100) + anglespeed/10 | |
| 586 | mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10)) | |
| 587 | local rscf = rsc0 | |
| 588 | local lscf = lsc0 | |
| 589 | local rlcf = rlc0 | |
| 590 | local llcf = llc0 | |
| 591 | local rjcf = rootc0 | |
| 592 | local ncf = neckc0 | |
| 593 | for i,object in pairs(char:children()) do | |
| 594 | if object:IsA("Tool") then
| |
| 595 | tool = true | |
| 596 | if not debounce then | |
| 597 | for x,value in pairs(object:children()) do | |
| 598 | if value:IsA("StringValue") and value.Name == "toolanim" and value.Value == "Slash" then
| |
| 599 | debounce = true | |
| 600 | coroutine.wrap(function() | |
| 601 | slashing = true | |
| 602 | wait(.25) | |
| 603 | slashing = false | |
| 604 | debounce = false | |
| 605 | end)() | |
| 606 | value:Destroy() | |
| 607 | end | |
| 608 | end | |
| 609 | end | |
| 610 | elseif not object:IsA'Tool' then | |
| 611 | tool = false | |
| 612 | end | |
| 613 | end | |
| 614 | if not humanoid.PlatformStand then | |
| 615 | if humanoid.Sit == true then | |
| 616 | speed = 0.2 | |
| 617 | anglespeed = 1/4 | |
| 618 | ncf = neckc0 * CFrame.Angles(0, 0, 0) | |
| 619 | rjcf = rootc0 | |
| 620 | rscf = rsc0 * CFrame.Angles(math.pi/2+math.sin(-angle)*0.05, 0, 0) | |
| 621 | lscf = lsc0 * CFrame.Angles(math.pi/2+math.sin(-angle)*0.05, 0, 0) | |
| 622 | rlcf = rlc0 * CFrame.Angles(math.pi/2+-math.rad(.2), 0, math.rad(.2)) | |
| 623 | llcf = llc0 * CFrame.Angles(math.pi/2+math.rad(.2), 0, -math.rad(.2)) | |
| 624 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 2 then | |
| 625 | anglespeed = 1/4 | |
| 626 | speed = 0.2 | |
| 627 | ncf = neckc0 * CFrame.Angles(math.sin(angle)*0.075, 0, 0) | |
| 628 | rjcf = rootc0 | |
| 629 | rscf = rsc0 * CFrame.new(0, math.sin(angle)*0.05, 0) * CFrame.Angles(math.sin(-angle)*0.05, 0, 0) | |
| 630 | lscf = lsc0 * CFrame.new(0, math.sin(angle)*0.05, 0) * CFrame.Angles(math.sin(-angle)*0.05, 0, 0) | |
| 631 | rlcf = rlc0 * CFrame.Angles(-math.rad(.2), 0, math.rad(.2)) | |
| 632 | llcf = llc0 * CFrame.Angles(math.rad(.2), 0, -math.rad(.2)) | |
| 633 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 20 then | |
| 634 | anglespeed = 1.7 | |
| 635 | speed = 0.25 | |
| 636 | anglespeed = 2.2 | |
| 637 | speed = 0.25 | |
| 638 | ncf = neckc0 * CFrame.Angles(0, 0, 0) | |
| 639 | rjcf = rootc0 * CFrame.new(0, math.abs(math.sin(angle))*.055, 0) * CFrame.Angles(-math.rad(1), 0, 0) | |
| 640 | rscf = rsc0 * CFrame.Angles(math.sin(angle)*.5, 0, -math.rad(1)) | |
| 641 | lscf = lsc0 * CFrame.Angles(math.sin(-angle)*.5, 0, math.rad(1)) | |
| 642 | rlcf = rlc0 * CFrame.new(0, .075 + -math.cos(-angle)*.075, math.sin(angle)*0.1) * CFrame.Angles(math.sin(-angle)*.45, 0, math.rad(.5)) | |
| 643 | llcf = llc0 * CFrame.new(0, .075 - -math.cos(angle)*.075, -math.sin(angle)*0.1) * CFrame.Angles(math.sin(angle)*.45, 0, -math.rad(.5)) | |
| 644 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then | |
| 645 | local RotVelocityZ = torso.RotVelocity.Y | |
| 646 | if RotVelocityZ >= 15 then | |
| 647 | RotVelocityZ = 15 | |
| 648 | elseif RotVelocityZ <= -15 then | |
| 649 | RotVelocityZ = -15 | |
| 650 | end | |
| 651 | speed = 0.25 | |
| 652 | anglespeed = 2.7 | |
| 653 | ncf = neckc0 * CFrame.Angles(0, 0, -math.sin(angle)*.045) | |
| 654 | rscf = rsc0 * CFrame.new(0, 0, -math.sin(angle)*0.125) * CFrame.Angles(math.pi/14+math.sin(angle)*1.5, 0, -math.sin(math.abs(angle))*0.3) | |
| 655 | lscf = lsc0 * CFrame.new(0, 0, math.sin(angle)*0.125) * CFrame.Angles(math.pi/14+math.sin(-angle)*1.5, 0, -math.sin(math.abs(angle))*0.3) | |
| 656 | rjcf = rootc0 * CFrame.new(0, math.abs(math.sin(angle))*.175 - .2, 0) * CFrame.Angles(math.abs(math.sin(angle))*0.055 + -math.pi/18, 0, math.rad(RotVelocityZ) + math.sin(angle)*.045) | |
| 657 | rlcf = rlc0 * CFrame.new(0, .3 + -math.cos(-angle)*.3, -.2+math.sin(angle)*0.25) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.3, 0, math.rad(.5)) | |
| 658 | llcf = llc0 * CFrame.new(0, .3 - -math.cos(angle)*.3, -.05-math.sin(angle)*0.25) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.3, 0, -math.rad(.5)) | |
| 659 | end | |
| 660 | if tool then | |
| 661 | rscf = rsc0 * CFrame.Angles(math.pi/2, 0, 0) | |
| 662 | if slashing then | |
| 663 | rscf = rsc0 | |
| 664 | end | |
| 665 | end | |
| 666 | end | |
| 667 | if pa2.Parent == nil then | |
| 668 | rm.C0 = clerp(rm.C0,rscf,speed) | |
| 669 | end | |
| 670 | if pa.Parent == nil then | |
| 671 | lm.C0 = clerp(lm.C0,lscf,speed) | |
| 672 | end | |
| 673 | rj.C0 = clerp(rj.C0,rjcf,speed) | |
| 674 | neck.C0 = clerp(neck.C0,ncf,speed) | |
| 675 | rlegm.C0 = clerp(rlegm.C0,rlcf,speed) | |
| 676 | llegm.C0 = clerp(llegm.C0,llcf,speed) | |
| 677 | end) | |
| 678 | ||
| 679 | ||
| 680 | ||
| 681 | game:service'RunService'.RenderStepped:connect(function() | |
| 682 | if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 225 then | |
| 683 | TorsoSmoke.Enabled = true | |
| 684 | else | |
| 685 | TorsoSmoke.Enabled = false | |
| 686 | end | |
| 687 | local ray = Ray.new(rootpart.Position, Vector3.new(0, -7, 0)) | |
| 688 | local hitz, enz = workspace:FindPartOnRay(ray, char) | |
| 689 | if hitz and hitz.CanCollide and pa.Parent ~= char and pa2.Parent ~= char then | |
| 690 | bodygyro.Parent = nil | |
| 691 | humanoid.PlatformStand = false | |
| 692 | end | |
| 693 | if pa.Parent ~= nil or Grapple1 then | |
| 694 | local size = (ropeStart2.Position-pa.Position).magnitude | |
| 695 | ropePA.Size = Vector3.new(.2, size, .2) | |
| 696 | ropePA.CFrame = CFrame.new(ropeStart2.Position, pa.Position) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new(0, -size/2, 0) | |
| 697 | lm.C0 = CFrame.new(Vector3.new(lsc0.x, lsc0.y, lsc0.z), torso.CFrame:pointToObjectSpace(pa.Position)) * CFrame.Angles(math.pi/2, 0, 0) | |
| 698 | else | |
| 699 | if not debounce and humanoid.PlatformStand then | |
| 700 | lm.C0 = lsc0 * CFrame.Angles(-.15, 0, -.15) | |
| 701 | end | |
| 702 | end | |
| 703 | if pa2.Parent ~= nil or Grapple2 then | |
| 704 | local size = (ropeStart.Position-pa2.Position).magnitude | |
| 705 | ropePA2.Size = Vector3.new(.2, size, .2) | |
| 706 | ropePA2.CFrame = CFrame.new(ropeStart.Position, pa2.Position) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new(0, -size/2, 0) | |
| 707 | rm.C0 = CFrame.new(Vector3.new(rsc0.x, rsc0.y, rsc0.z), torso.CFrame:pointToObjectSpace(pa2.Position)) * CFrame.Angles(math.pi/2, 0, 0) | |
| 708 | else | |
| 709 | if not debounce and humanoid.PlatformStand then | |
| 710 | rm.C0 = rsc0 * CFrame.Angles(-.15, 0, .15) | |
| 711 | end | |
| 712 | end | |
| 713 | if Grapple1 and Grapple1Hit.Parent == nil then | |
| 714 | pcall(function() Gweld:remove() end) | |
| 715 | pa.Parent = nil | |
| 716 | Grapple1 = false | |
| 717 | ro:Abort() | |
| 718 | end | |
| 719 | if Grapple2 and Grapple2Hit.Parent == nil then | |
| 720 | pcall(function() Gweld2:remove() end) | |
| 721 | pa2.Parent = nil | |
| 722 | Grapple2 = false | |
| 723 | ro2:Abort() | |
| 724 | end | |
| 725 | if Grapple1 and Grapple2 and (humanoid.PlatformStand or not hitz) then | |
| 726 | local distance = (pa.Position-pa2.Position).magnitude | |
| 727 | bodygyro.Parent = torso | |
| 728 | torso.CFrame = CFrame.new(torso.Position, Vector3.new(camera.CoordinateFrame.x, camera.CoordinateFrame.y, camera.CoordinateFrame.z)) * CFrame.Angles(0, math.pi, 0) | |
| 729 | bodygyro.cframe = CFrame.new(torso.Position, Vector3.new(camera.CoordinateFrame.x, camera.CoordinateFrame.y, camera.CoordinateFrame.z)) * CFrame.Angles(0, math.pi, 0) | |
| 730 | pa3.Parent = char | |
| 731 | if distance <= .5 then | |
| 732 | pa3.CFrame = pa.CFrame | |
| 733 | elseif distance > .5 then | |
| 734 | pa3.CFrame = CFrame.new(pa.Position, pa2.Position) * CFrame.new(0, 0, -distance/2) | |
| 735 | end | |
| 736 | if not MidPointUsed then | |
| 737 | ro3=Instance.new("RocketPropulsion",torso3)
| |
| 738 | ro3.Name = 'RockatPropoolsun3' | |
| 739 | ro3.MaxSpeed=250 | |
| 740 | ro3.MaxThrust=16000 | |
| 741 | ro3.TurnP = 0 | |
| 742 | ro3.TurnD = 0 | |
| 743 | ro3.MaxTorque=Vector3.new(14e16,14e16,14e16) | |
| 744 | if humanoid.PlatformStand or not hitz then | |
| 745 | ro:Abort() | |
| 746 | ro2:Abort() | |
| 747 | end | |
| 748 | ro3.Target = pa3 | |
| 749 | if humanoid.PlatformStand or not hitz then | |
| 750 | ro3:Fire() | |
| 751 | end | |
| 752 | MidPointUsed = true | |
| 753 | end | |
| 754 | elseif (not Grapple1 or not Grapple2) and MidPointUsed == true and (humanoid.PlatformStand or not hitz) then | |
| 755 | pa3.Parent = nil | |
| 756 | MidPointUsed = false | |
| 757 | ro3:Abort() | |
| 758 | ro3:Destroy() | |
| 759 | if Grapple1 then | |
| 760 | ro:Fire() | |
| 761 | end | |
| 762 | if Grapple2 then | |
| 763 | ro2:Fire() | |
| 764 | end | |
| 765 | end | |
| 766 | if not Grapple1 then | |
| 767 | pcall(function() Gweld:remove() end) | |
| 768 | end | |
| 769 | if not Grapple2 then | |
| 770 | pcall(function() Gweld2:remove() end) | |
| 771 | end | |
| 772 | if (Grapple1 or Grapple2) and not hitz then | |
| 773 | bodygyro.Parent = torso | |
| 774 | humanoid.PlatformStand = true | |
| 775 | rlegm.Parent = torso | |
| 776 | llegm.Parent = torso | |
| 777 | lm.Parent = torso | |
| 778 | rm.Parent = torso | |
| 779 | rlegm.C0 = rlc0 * CFrame.new(0, .5, -.65) * CFrame.Angles(-math.pi/8, 0, .1) | |
| 780 | llegm.C0 = llc0 * CFrame.new(0, .5, -.65) * CFrame.Angles(-math.pi/8, 0, -.1) | |
| 781 | end | |
| 782 | if (Grapple1 or Grapple2) and not hitz or humanoid.PlatformStand then | |
| 783 | bodygyro.Parent = torso | |
| 784 | bodygyro.cframe = CFrame.new(torso.Position, Vector3.new(camera.CoordinateFrame.x, camera.CoordinateFrame.y, camera.CoordinateFrame.z)) * CFrame.Angles(0, math.pi, 0) | |
| 785 | rlegm.Parent = torso | |
| 786 | llegm.Parent = torso | |
| 787 | rlegm.C0 = rlc0 * CFrame.new(0, .5, -.65) * CFrame.Angles(-math.pi/8, 0, .1) | |
| 788 | llegm.C0 = llc0 * CFrame.new(0, .5, -.65) * CFrame.Angles(-math.pi/8, 0, -.1) | |
| 789 | end | |
| 790 | end) |