Advertisement
Guest User

Snake Script For Roblox

a guest
Aug 19th, 2023
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.34 KB | Gaming | 0 0
  1. me = workspace[game.Players.LocalPlayer.Name]
  2.  
  3. local rtype = 0
  4. if me.Humanoid.RigType == Enum.HumanoidRigType.R6 then
  5. rtype = 1
  6. end
  7.  
  8. local v3_net, v3_808 = Vector3.new(0.1, 25.1, 0.1), Vector3.new(8, 0, 8)
  9. local function getNetlessVelocity(realPartVelocity)
  10. if realPartVelocity.Magnitude > 1 then
  11. local unit = realPartVelocity.Unit
  12. if (unit.Y > 0.25) or (unit.Y < -0.75) then
  13. return unit * (25.1 / unit.Y)
  14. end
  15. end
  16. return v3_net + realPartVelocity * v3_808
  17. end
  18. local simradius = "shp" --simulation radius (net bypass) method
  19. --"shp" - sethiddenproperty
  20. --"ssr" - setsimulationradius
  21. --false - disable
  22. local simrad = 1000 --simulation radius value
  23. local healthHide = false --moves your head away every 3 seconds so players dont see your health bar (alignmode 4 only)
  24. local reclaim = true --if you lost control over a part this will move your primary part to the part so you get it back (alignmode 4)
  25. local novoid = true --prevents parts from going under workspace.FallenPartsDestroyHeight if you control them (alignmode 4 only)
  26. local physp = nil --PhysicalProperties.new(0.01, 0, 1, 0, 0) --sets .CustomPhysicalProperties to this for each part
  27. local noclipAllParts = false --set it to true if you want noclip
  28. local antiragdoll = true --removes hingeConstraints and ballSocketConstraints from your character
  29. local newanimate = true --disables the animate script and enables after reanimation
  30. local discharscripts = true --disables all localScripts parented to your character before reanimation
  31. local R15toR6 = true --tries to convert your character to r6 if its r15
  32. local hatcollide = true --makes hats cancollide (credit to ShownApe) (works only with reanimate method 0)
  33. local humState16 = true --enables collisions for limbs before the humanoid dies (using hum:ChangeState)
  34. local addtools = false --puts all tools from backpack to character and lets you hold them after reanimation
  35. local hedafterneck = true --disable aligns for head and enable after neck or torso is removed
  36. local loadtime = game:GetService("Players").RespawnTime + 0.5 --anti respawn delay
  37. local method = 3 --reanimation method
  38. --methods:
  39. --0 - breakJoints (takes [loadtime] seconds to load)
  40. --1 - limbs
  41. --2 - limbs + anti respawn
  42. --3 - limbs + breakJoints after [loadtime] seconds
  43. --4 - remove humanoid + breakJoints
  44. --5 - remove humanoid + limbs
  45. local alignmode = 4 --AlignPosition mode
  46. --modes:
  47. --1 - AlignPosition rigidity enabled true
  48. --2 - 2 AlignPositions rigidity enabled both true and false
  49. --3 - AlignPosition rigidity enabled false
  50. --4 - no AlignPosition, CFrame only
  51. local flingpart = "HumanoidRootPart" --name of the part or the hat used for flinging
  52. --the fling function
  53. --usage: fling(target, duration, velocity)
  54. --target can be set to: basePart, CFrame, Vector3, character model or humanoid (flings at mouse.Hit if argument not provided)
  55. --duration (fling time in seconds) can be set to a number or a string convertable to a number (0.5s if not provided)
  56. --velocity (fling part rotation velocity) can be set to a vector3 value (Vector3.new(20000, 20000, 20000) if not provided)
  57.  
  58. local lp = game:GetService("Players").LocalPlayer
  59. local rs, ws, sg = game:GetService("RunService"), game:GetService("Workspace"), game:GetService("StarterGui")
  60. local stepped, heartbeat, renderstepped = rs.Stepped, rs.Heartbeat, rs.RenderStepped
  61. local twait, tdelay, rad, inf, abs, clamp = task.wait, task.delay, math.rad, math.huge, math.abs, math.clamp
  62. local cf, v3, angles = CFrame.new, Vector3.new, CFrame.Angles
  63. local v3_0, cf_0 = v3(0, 0, 0), cf(0, 0, 0)
  64.  
  65. local c = lp.Character
  66. if not (c and c.Parent) then
  67. return
  68. end
  69.  
  70. c:GetPropertyChangedSignal("Parent"):Connect(function()
  71. if not (c and c.Parent) then
  72. c = nil
  73. end
  74. end)
  75.  
  76. local clone, destroy, getchildren, getdescendants, isa = c.Clone, c.Destroy, c.GetChildren, c.GetDescendants, c.IsA
  77.  
  78. local function gp(parent, name, className)
  79. if typeof(parent) == "Instance" then
  80. for i, v in pairs(getchildren(parent)) do
  81. if (v.Name == name) and isa(v, className) then
  82. return v
  83. end
  84. end
  85. end
  86. return nil
  87. end
  88.  
  89. local fenv = getfenv()
  90.  
  91. local shp = fenv.sethiddenproperty or fenv.set_hidden_property or fenv.set_hidden_prop or fenv.sethiddenprop
  92. local ssr = fenv.setsimulationradius or fenv.set_simulation_radius or fenv.set_sim_radius or fenv.setsimradius or fenv.setsimrad or fenv.set_sim_rad
  93.  
  94. healthHide = healthHide and ((method == 0) or (method == 2) or (method == 3)) and gp(c, "Head", "BasePart")
  95.  
  96. local reclaim, lostpart = reclaim and c.PrimaryPart, nil
  97.  
  98. local function align(Part0, Part1)
  99.  
  100. local att0 = Instance.new("Attachment")
  101. att0.Position, att0.Orientation, att0.Name = v3_0, v3_0, "att0_" .. Part0.Name
  102. local att1 = Instance.new("Attachment")
  103. att1.Position, att1.Orientation, att1.Name = v3_0, v3_0, "att1_" .. Part1.Name
  104.  
  105. if alignmode == 4 then
  106.  
  107. local hide = false
  108. if Part0 == healthHide then
  109. healthHide = false
  110. tdelay(0, function()
  111. while twait(2.9) and Part0 and c do
  112. hide = #Part0:GetConnectedParts() == 1
  113. twait(0.1)
  114. hide = false
  115. end
  116. end)
  117. end
  118.  
  119. local rot = rad(0.05)
  120. local con0, con1 = nil, nil
  121. con0 = stepped:Connect(function()
  122. if not (Part0 and Part1) then return con0:Disconnect() and con1:Disconnect() end
  123. Part0.RotVelocity = Part1.RotVelocity
  124. end)
  125. local lastpos = Part0.Position
  126. con1 = heartbeat:Connect(function(delta)
  127. if not (Part0 and Part1 and att1) then return con0:Disconnect() and con1:Disconnect() end
  128. if (not Part0.Anchored) and (Part0.ReceiveAge == 0) then
  129. if lostpart == Part0 then
  130. lostpart = nil
  131. end
  132. local newcf = Part1.CFrame * att1.CFrame
  133. if Part1.Velocity.Magnitude > 0.1 then
  134. Part0.Velocity = getNetlessVelocity(Part1.Velocity)
  135. else
  136. local vel = (newcf.Position - lastpos) / delta
  137. Part0.Velocity = getNetlessVelocity(vel)
  138. if vel.Magnitude < 1 then
  139. rot = -rot
  140. newcf *= angles(0, 0, rot)
  141. end
  142. end
  143. lastpos = newcf.Position
  144. if lostpart and (Part0 == reclaim) then
  145. newcf = lostpart.CFrame
  146. elseif hide then
  147. newcf += v3(0, 3000, 0)
  148. end
  149. if novoid and (newcf.Y < ws.FallenPartsDestroyHeight + 0.1) then
  150. newcf += v3(0, ws.FallenPartsDestroyHeight + 0.1 - newcf.Y, 0)
  151. end
  152. Part0.CFrame = newcf
  153. elseif (not Part0.Anchored) and (abs(Part0.Velocity.X) < 45) and (abs(Part0.Velocity.Y) < 25) and (abs(Part0.Velocity.Z) < 45) then
  154. lostpart = Part0
  155. end
  156. end)
  157.  
  158. else
  159.  
  160. Part0.CustomPhysicalProperties = physp
  161. if (alignmode == 1) or (alignmode == 2) then
  162. local ape = Instance.new("AlignPosition")
  163. ape.MaxForce, ape.MaxVelocity, ape.Responsiveness = inf, inf, inf
  164. ape.ReactionForceEnabled, ape.RigidityEnabled, ape.ApplyAtCenterOfMass = false, true, false
  165. ape.Attachment0, ape.Attachment1, ape.Name = att0, att1, "AlignPositionRtrue"
  166. ape.Parent = att0
  167. end
  168.  
  169. if (alignmode == 2) or (alignmode == 3) then
  170. local apd = Instance.new("AlignPosition")
  171. apd.MaxForce, apd.MaxVelocity, apd.Responsiveness = inf, inf, inf
  172. apd.ReactionForceEnabled, apd.RigidityEnabled, apd.ApplyAtCenterOfMass = false, false, false
  173. apd.Attachment0, apd.Attachment1, apd.Name = att0, att1, "AlignPositionRfalse"
  174. apd.Parent = att0
  175. end
  176.  
  177. local ao = Instance.new("AlignOrientation")
  178. ao.MaxAngularVelocity, ao.MaxTorque, ao.Responsiveness = inf, inf, inf
  179. ao.PrimaryAxisOnly, ao.ReactionTorqueEnabled, ao.RigidityEnabled = false, false, false
  180. ao.Attachment0, ao.Attachment1 = att0, att1
  181. ao.Parent = att0
  182.  
  183. local con0, con1 = nil, nil
  184. local vel = Part0.Velocity
  185. con0 = renderstepped:Connect(function()
  186. if not (Part0 and Part1) then return con0:Disconnect() and con1:Disconnect() end
  187. Part0.Velocity = vel
  188. end)
  189. local lastpos = Part0.Position
  190. con1 = heartbeat:Connect(function(delta)
  191. if not (Part0 and Part1) then return con0:Disconnect() and con1:Disconnect() end
  192. vel = Part0.Velocity
  193. if Part1.Velocity.Magnitude > 0.01 then
  194. Part0.Velocity = getNetlessVelocity(Part1.Velocity)
  195. else
  196. Part0.Velocity = getNetlessVelocity((Part0.Position - lastpos) / delta)
  197. end
  198. lastpos = Part0.Position
  199. end)
  200.  
  201. end
  202.  
  203. att0:GetPropertyChangedSignal("Parent"):Connect(function()
  204. Part0 = att0.Parent
  205. if not isa(Part0, "BasePart") then
  206. att0 = nil
  207. if lostpart == Part0 then
  208. lostpart = nil
  209. end
  210. Part0 = nil
  211. end
  212. end)
  213. att0.Parent = Part0
  214.  
  215. att1:GetPropertyChangedSignal("Parent"):Connect(function()
  216. Part1 = att1.Parent
  217. if not isa(Part1, "BasePart") then
  218. att1 = nil
  219. Part1 = nil
  220. end
  221. end)
  222. att1.Parent = Part1
  223. end
  224.  
  225. local function respawnrequest()
  226. local ccfr, c = ws.CurrentCamera.CFrame, lp.Character
  227. lp.Character = nil
  228. lp.Character = c
  229. local con = nil
  230. con = ws.CurrentCamera.Changed:Connect(function(prop)
  231. if (prop ~= "Parent") and (prop ~= "CFrame") then
  232. return
  233. end
  234. ws.CurrentCamera.CFrame = ccfr
  235. con:Disconnect()
  236. end)
  237. end
  238.  
  239. local destroyhum = (method == 4) or (method == 5)
  240. local breakjoints = (method == 0) or (method == 4)
  241. local antirespawn = (method == 0) or (method == 2) or (method == 3)
  242.  
  243. hatcollide = hatcollide and (method == 0)
  244.  
  245. addtools = addtools and lp:FindFirstChildOfClass("Backpack")
  246.  
  247. if type(simrad) ~= "number" then simrad = 1000 end
  248. if shp and (simradius == "shp") then
  249. tdelay(0, function()
  250. while c do
  251. shp(lp, "SimulationRadius", simrad)
  252. heartbeat:Wait()
  253. end
  254. end)
  255. elseif ssr and (simradius == "ssr") then
  256. tdelay(0, function()
  257. while c do
  258. ssr(simrad)
  259. heartbeat:Wait()
  260. end
  261. end)
  262. end
  263.  
  264. if antiragdoll then
  265. antiragdoll = function(v)
  266. if isa(v, "HingeConstraint") or isa(v, "BallSocketConstraint") then
  267. v.Parent = nil
  268. end
  269. end
  270. for i, v in pairs(getdescendants(c)) do
  271. antiragdoll(v)
  272. end
  273. c.DescendantAdded:Connect(antiragdoll)
  274. end
  275.  
  276. if antirespawn then
  277. respawnrequest()
  278. end
  279.  
  280. if method == 0 then
  281. twait(loadtime)
  282. if not c then
  283. return
  284. end
  285. end
  286.  
  287. if discharscripts then
  288. for i, v in pairs(getdescendants(c)) do
  289. if isa(v, "LocalScript") then
  290. v.Disabled = true
  291. end
  292. end
  293. elseif newanimate then
  294. local animate = gp(c, "Animate", "LocalScript")
  295. if animate and (not animate.Disabled) then
  296. animate.Disabled = true
  297. else
  298. newanimate = false
  299. end
  300. end
  301.  
  302. if addtools then
  303. for i, v in pairs(getchildren(addtools)) do
  304. if isa(v, "Tool") then
  305. v.Parent = c
  306. end
  307. end
  308. end
  309.  
  310. pcall(function()
  311. settings().Physics.AllowSleep = false
  312. settings().Physics.PhysicsEnvironmentalThrottle = Enum.EnviromentalPhysicsThrottle.Disabled
  313. end)
  314.  
  315. local OLDscripts = {}
  316.  
  317. for i, v in pairs(getdescendants(c)) do
  318. if v.ClassName == "Script" then
  319. OLDscripts[v.Name] = true
  320. end
  321. end
  322.  
  323. local scriptNames = {}
  324.  
  325. for i, v in pairs(getdescendants(c)) do
  326. if isa(v, "BasePart") then
  327. local newName, exists = tostring(i), true
  328. while exists do
  329. exists = OLDscripts[newName]
  330. if exists then
  331. newName = newName .. "_"
  332. end
  333. end
  334. table.insert(scriptNames, newName)
  335. Instance.new("Script", v).Name = newName
  336. end
  337. end
  338.  
  339. local hum = c:FindFirstChildOfClass("Humanoid")
  340. if hum then
  341. for i, v in pairs(hum:GetPlayingAnimationTracks()) do
  342. v:Stop()
  343. end
  344. end
  345. c.Archivable = true
  346. local cl = clone(c)
  347. if hum and humState16 then
  348. hum:ChangeState(Enum.HumanoidStateType.Physics)
  349. if destroyhum then
  350. twait(1.6)
  351. end
  352. end
  353. if destroyhum then
  354. pcall(destroy, hum)
  355. end
  356.  
  357. if not c then
  358. return
  359. end
  360.  
  361. local head, torso, root = gp(c, "Head", "BasePart"), gp(c, "Torso", "BasePart") or gp(c, "UpperTorso", "BasePart"), gp(c, "HumanoidRootPart", "BasePart")
  362. if hatcollide then
  363. pcall(destroy, torso)
  364. pcall(destroy, root)
  365. pcall(destroy, c:FindFirstChildOfClass("BodyColors") or gp(c, "Health", "Script"))
  366. end
  367.  
  368. local model = Instance.new("Model", c)
  369. model:GetPropertyChangedSignal("Parent"):Connect(function()
  370. if not (model and model.Parent) then
  371. model = nil
  372. end
  373. end)
  374.  
  375. for i, v in pairs(getchildren(c)) do
  376. if v ~= model then
  377. if addtools and isa(v, "Tool") then
  378. for i1, v1 in pairs(getdescendants(v)) do
  379. if v1 and v1.Parent and isa(v1, "BasePart") then
  380. local bv = Instance.new("BodyVelocity")
  381. bv.Velocity, bv.MaxForce, bv.P, bv.Name = v3_0, v3(1000, 1000, 1000), 1250, "bv_" .. v.Name
  382. bv.Parent = v1
  383. end
  384. end
  385. end
  386. v.Parent = model
  387. end
  388. end
  389.  
  390. if breakjoints then
  391. model:BreakJoints()
  392. else
  393. if head and torso then
  394. for i, v in pairs(getdescendants(model)) do
  395. if isa(v, "JointInstance") then
  396. local save = false
  397. if (v.Part0 == torso) and (v.Part1 == head) then
  398. save = true
  399. end
  400. if (v.Part0 == head) and (v.Part1 == torso) then
  401. save = true
  402. end
  403. if save then
  404. if hedafterneck then
  405. hedafterneck = v
  406. end
  407. else
  408. pcall(destroy, v)
  409. end
  410. end
  411. end
  412. end
  413. if method == 3 then
  414. task.delay(loadtime, pcall, model.BreakJoints, model)
  415. end
  416. end
  417.  
  418. cl.Parent = ws
  419. for i, v in pairs(getchildren(cl)) do
  420. v.Parent = c
  421. end
  422. pcall(destroy, cl)
  423.  
  424. local uncollide, noclipcon = nil, nil
  425. if noclipAllParts then
  426. uncollide = function()
  427. if c then
  428. for i, v in pairs(getdescendants(c)) do
  429. if isa(v, "BasePart") then
  430. v.CanCollide = false
  431. end
  432. end
  433. else
  434. noclipcon:Disconnect()
  435. end
  436. end
  437. else
  438. uncollide = function()
  439. if model then
  440. for i, v in pairs(getdescendants(model)) do
  441. if isa(v, "BasePart") then
  442. v.CanCollide = false
  443. end
  444. end
  445. else
  446. noclipcon:Disconnect()
  447. end
  448. end
  449. end
  450. noclipcon = stepped:Connect(uncollide)
  451. uncollide()
  452.  
  453. for i, scr in pairs(getdescendants(model)) do
  454. if (scr.ClassName == "Script") and table.find(scriptNames, scr.Name) then
  455. local Part0 = scr.Parent
  456. if isa(Part0, "BasePart") then
  457. for i1, scr1 in pairs(getdescendants(c)) do
  458. if (scr1.ClassName == "Script") and (scr1.Name == scr.Name) and (not scr1:IsDescendantOf(model)) then
  459. local Part1 = scr1.Parent
  460. if (Part1.ClassName == Part0.ClassName) and (Part1.Name == Part0.Name) then
  461. align(Part0, Part1)
  462. pcall(destroy, scr)
  463. pcall(destroy, scr1)
  464. break
  465. end
  466. end
  467. end
  468. end
  469. end
  470. end
  471.  
  472. for i, v in pairs(getdescendants(c)) do
  473. if v and v.Parent and (not v:IsDescendantOf(model)) then
  474. if isa(v, "Decal") then
  475. v.Transparenc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement