r6 script - Pastebin.com (2024)

  1. function oof()

  2. game:GetObjects("rbxassetid://1561389244")[1].Parent=game.Workspace.Terrain

  3. local c = game.Workspace.Terrain:FindFirstChildOfClass("Model"):Clone()

  4. c.Parent = game.Workspace

  5. c:MoveTo(game.Players.LocalPlayer.Character.HumanoidRootPart.Position)

  6. game.Workspace.Terrain:FindFirstChildOfClass("Model"):remove()

  7. c.Name = game.Players.LocalPlayer.Name

  8. game.Players.LocalPlayer.Character = c

  9. game.Workspace.CurrentCamera.CameraSubject = c:FindFirstChildOfClass("Humanoid")

  10. local Figure = game.Players.LocalPlayer.Character

  11. local Torso = Figure:WaitForChild("Torso")

  12. local RightShoulder = Torso:WaitForChild("Right Shoulder")

  13. local LeftShoulder = Torso:WaitForChild("Left Shoulder")

  14. local RightHip = Torso:WaitForChild("Right Hip")

  15. local LeftHip = Torso:WaitForChild("Left Hip")

  16. local Neck = Torso:WaitForChild("Neck")

  17. local Humanoid = Figure:WaitForChild("Humanoid")

  18. local pose = "Standing"

  19. local currentAnim = ""

  20. local currentAnimInstance = nil

  21. local currentAnimTrack = nil

  22. local currentAnimKeyframeHandler = nil

  23. local currentAnimSpeed = 1.0

  24. local animTable = {}

  25. local animNames = {

  26. idle = {

  27. { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },

  28. { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }

  29. },

  30. walk = {

  31. { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }

  32. },

  33. run = {

  34. { id = "run.xml", weight = 10 }

  35. },

  36. jump = {

  37. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }

  38. },

  39. fall = {

  40. { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }

  41. },

  42. climb = {

  43. { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }

  44. },

  45. sit = {

  46. { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }

  47. },

  48. toolnone = {

  49. { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }

  50. },

  51. toolslash = {

  52. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }

  53. -- { id = "slash.xml", weight = 10 }

  54. },

  55. toollunge = {

  56. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }

  57. },

  58. wave = {

  59. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }

  60. },

  61. point = {

  62. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }

  63. },

  64. dance1 = {

  65. { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },

  66. { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },

  67. { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }

  68. },

  69. dance2 = {

  70. { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },

  71. { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },

  72. { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }

  73. },

  74. dance3 = {

  75. { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },

  76. { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },

  77. { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }

  78. },

  79. laugh = {

  80. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }

  81. },

  82. cheer = {

  83. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }

  84. },

  85. }

  86. local dances = {"dance1", "dance2", "dance3"}

  87. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote

  88. local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}

  89. function configureAnimationSet(name, fileList)

  90. if (animTable[name] ~= nil) then

  91. for _, connection in pairs(animTable[name].connections) do

  92. connection:disconnect()

  93. end

  94. end

  95. animTable[name] = {}

  96. animTable[name].count = 0

  97. animTable[name].totalWeight = 0

  98. animTable[name].connections = {}

  99. -- check for config values

  100. local config = game.Players.LocalPlayer.Character.Animate:FindFirstChild(name)

  101. if (config ~= nil) then

  102. -- print("Loading anims " .. name)

  103. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))

  104. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))

  105. local idx = 1

  106. for _, childPart in pairs(config:GetChildren()) do

  107. if (childPart:IsA("Animation")) then

  108. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))

  109. animTable[name][idx] = {}

  110. animTable[name][idx].anim = childPart

  111. local weightObject = childPart:FindFirstChild("Weight")

  112. if (weightObject == nil) then

  113. animTable[name][idx].weight = 1

  114. else

  115. animTable[name][idx].weight = weightObject.Value

  116. end

  117. animTable[name].count = animTable[name].count + 1

  118. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight

  119. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")

  120. idx = idx + 1

  121. end

  122. end

  123. end

  124. -- fallback to defaults

  125. if (animTable[name].count <= 0) then

  126. for idx, anim in pairs(fileList) do

  127. animTable[name][idx] = {}

  128. animTable[name][idx].anim = Instance.new("Animation")

  129. animTable[name][idx].anim.Name = name

  130. animTable[name][idx].anim.AnimationId = anim.id

  131. animTable[name][idx].weight = anim.weight

  132. animTable[name].count = animTable[name].count + 1

  133. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight

  134. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")

  135. end

  136. end

  137. end

  138. -- Setup animation objects

  139. function scriptChildModified(child)

  140. local fileList = animNames[child.Name]

  141. if (fileList ~= nil) then

  142. configureAnimationSet(child.Name, fileList)

  143. end

  144. end

  145. game.Players.LocalPlayer.Character.Animate.ChildAdded:connect(scriptChildModified)

  146. game.Players.LocalPlayer.Character.Animate.ChildRemoved:connect(scriptChildModified)

  147. for name, fileList in pairs(animNames) do

  148. configureAnimationSet(name, fileList)

  149. end

  150. -- ANIMATION

  151. -- declarations

  152. local toolAnim = "None"

  153. local toolAnimTime = 0

  154. local jumpAnimTime = 0

  155. local jumpAnimDuration = 0.3

  156. local toolTransitionTime = 0.1

  157. local fallTransitionTime = 0.3

  158. local jumpMaxLimbVelocity = 0.75

  159. -- functions

  160. function stopAllAnimations()

  161. local oldAnim = currentAnim

  162. -- return to idle if finishing an emote

  163. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then

  164. oldAnim = "idle"

  165. end

  166. currentAnim = ""

  167. currentAnimInstance = nil

  168. if (currentAnimKeyframeHandler ~= nil) then

  169. currentAnimKeyframeHandler:disconnect()

  170. end

  171. if (currentAnimTrack ~= nil) then

  172. currentAnimTrack:Stop()

  173. currentAnimTrack:Destroy()

  174. currentAnimTrack = nil

  175. end

  176. return oldAnim

  177. end

  178. function setAnimationSpeed(speed)

  179. if speed ~= currentAnimSpeed then

  180. currentAnimSpeed = speed

  181. currentAnimTrack:AdjustSpeed(currentAnimSpeed)

  182. end

  183. end

  184. function keyFrameReachedFunc(frameName)

  185. if (frameName == "End") then

  186. local repeatAnim = currentAnim

  187. -- return to idle if finishing an emote

  188. if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then

  189. repeatAnim = "idle"

  190. end

  191. local animSpeed = currentAnimSpeed

  192. playAnimation(repeatAnim, 0.0, Humanoid)

  193. setAnimationSpeed(animSpeed)

  194. end

  195. end

  196. -- Preload animations

  197. function playAnimation(animName, transitionTime, humanoid)

  198. local roll = math.random(1, animTable[animName].totalWeight)

  199. local origRoll = roll

  200. local idx = 1

  201. while (roll > animTable[animName][idx].weight) do

  202. roll = roll - animTable[animName][idx].weight

  203. idx = idx + 1

  204. end

  205. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")

  206. local anim = animTable[animName][idx].anim

  207. -- switch animation

  208. if (anim ~= currentAnimInstance) then

  209. if (currentAnimTrack ~= nil) then

  210. currentAnimTrack:Stop(transitionTime)

  211. currentAnimTrack:Destroy()

  212. end

  213. currentAnimSpeed = 1.0

  214. -- load it to the humanoid; get AnimationTrack

  215. currentAnimTrack = humanoid:LoadAnimation(anim)

  216. currentAnimTrack.Priority = Enum.AnimationPriority.Core

  217. -- play the animation

  218. currentAnimTrack:Play(transitionTime)

  219. currentAnim = animName

  220. currentAnimInstance = anim

  221. -- set up keyframe name triggers

  222. if (currentAnimKeyframeHandler ~= nil) then

  223. currentAnimKeyframeHandler:disconnect()

  224. end

  225. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)

  226. end

  227. end

  228. -------------------------------------------------------------------------------------------

  229. -------------------------------------------------------------------------------------------

  230. local toolAnimName = ""

  231. local toolAnimTrack = nil

  232. local toolAnimInstance = nil

  233. local currentToolAnimKeyframeHandler = nil

  234. function toolKeyFrameReachedFunc(frameName)

  235. if (frameName == "End") then

  236. -- print("Keyframe : ".. frameName)

  237. playToolAnimation(toolAnimName, 0.0, Humanoid)

  238. end

  239. end

  240. function playToolAnimation(animName, transitionTime, humanoid, priority)

  241. local roll = math.random(1, animTable[animName].totalWeight)

  242. local origRoll = roll

  243. local idx = 1

  244. while (roll > animTable[animName][idx].weight) do

  245. roll = roll - animTable[animName][idx].weight

  246. idx = idx + 1

  247. end

  248. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")

  249. local anim = animTable[animName][idx].anim

  250. if (toolAnimInstance ~= anim) then

  251. if (toolAnimTrack ~= nil) then

  252. toolAnimTrack:Stop()

  253. toolAnimTrack:Destroy()

  254. transitionTime = 0

  255. end

  256. -- load it to the humanoid; get AnimationTrack

  257. toolAnimTrack = humanoid:LoadAnimation(anim)

  258. if priority then

  259. toolAnimTrack.Priority = priority

  260. end

  261. -- play the animation

  262. toolAnimTrack:Play(transitionTime)

  263. toolAnimName = animName

  264. toolAnimInstance = anim

  265. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)

  266. end

  267. end

  268. function stopToolAnimations()

  269. local oldAnim = toolAnimName

  270. if (currentToolAnimKeyframeHandler ~= nil) then

  271. currentToolAnimKeyframeHandler:disconnect()

  272. end

  273. toolAnimName = ""

  274. toolAnimInstance = nil

  275. if (toolAnimTrack ~= nil) then

  276. toolAnimTrack:Stop()

  277. toolAnimTrack:Destroy()

  278. toolAnimTrack = nil

  279. end

  280. return oldAnim

  281. end

  282. -------------------------------------------------------------------------------------------

  283. -------------------------------------------------------------------------------------------

  284. function onRunning(speed)

  285. if speed > 0.01 then

  286. playAnimation("walk", 0.1, Humanoid)

  287. if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then

  288. setAnimationSpeed(speed / 14.5)

  289. end

  290. pose = "Running"

  291. else

  292. if emoteNames[currentAnim] == nil then

  293. playAnimation("idle", 0.1, Humanoid)

  294. pose = "Standing"

  295. end

  296. end

  297. end

  298. function onDied()

  299. pose = "Dead"

  300. end

  301. function onJumping()

  302. playAnimation("jump", 0.1, Humanoid)

  303. jumpAnimTime = jumpAnimDuration

  304. pose = "Jumping"

  305. end

  306. function onClimbing(speed)

  307. playAnimation("climb", 0.1, Humanoid)

  308. setAnimationSpeed(speed / 12.0)

  309. pose = "Climbing"

  310. end

  311. function onGettingUp()

  312. pose = "GettingUp"

  313. end

  314. function onFreeFall()

  315. if (jumpAnimTime <= 0) then

  316. playAnimation("fall", fallTransitionTime, Humanoid)

  317. end

  318. pose = "FreeFall"

  319. end

  320. function onFallingDown()

  321. pose = "FallingDown"

  322. end

  323. function onSeated()

  324. pose = "Seated"

  325. end

  326. function onPlatformStanding()

  327. pose = "PlatformStanding"

  328. end

  329. function onSwimming(speed)

  330. if speed > 0 then

  331. pose = "Running"

  332. else

  333. pose = "Standing"

  334. end

  335. end

  336. function getTool()

  337. for _, kid in ipairs(Figure:GetChildren()) do

  338. if kid.className == "Tool" then return kid end

  339. end

  340. return nil

  341. end

  342. function getToolAnim(tool)

  343. for _, c in ipairs(tool:GetChildren()) do

  344. if c.Name == "toolanim" and c.className == "StringValue" then

  345. return c

  346. end

  347. end

  348. return nil

  349. end

  350. function animateTool()

  351. if (toolAnim == "None") then

  352. playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)

  353. return

  354. end

  355. if (toolAnim == "Slash") then

  356. playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)

  357. return

  358. end

  359. if (toolAnim == "Lunge") then

  360. playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)

  361. return

  362. end

  363. end

  364. function moveSit()

  365. RightShoulder.MaxVelocity = 0.15

  366. LeftShoulder.MaxVelocity = 0.15

  367. RightShoulder:SetDesiredAngle(3.14 /2)

  368. LeftShoulder:SetDesiredAngle(-3.14 /2)

  369. RightHip:SetDesiredAngle(3.14 /2)

  370. LeftHip:SetDesiredAngle(-3.14 /2)

  371. end

  372. local lastTick = 0

  373. function move(time)

  374. local amplitude = 1

  375. local frequency = 1

  376. local deltaTime = time - lastTick

  377. lastTick = time

  378. local climbFudge = 0

  379. local setAngles = false

  380. if (jumpAnimTime > 0) then

  381. jumpAnimTime = jumpAnimTime - deltaTime

  382. end

  383. if (pose == "FreeFall" and jumpAnimTime <= 0) then

  384. playAnimation("fall", fallTransitionTime, Humanoid)

  385. elseif (pose == "Seated") then

  386. playAnimation("sit", 0.5, Humanoid)

  387. return

  388. elseif (pose == "Running") then

  389. playAnimation("walk", 0.1, Humanoid)

  390. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then

  391. -- print("Wha " .. pose)

  392. stopAllAnimations()

  393. amplitude = 0.1

  394. frequency = 1

  395. setAngles = true

  396. end

  397. if (setAngles) then

  398. local desiredAngle = amplitude * math.sin(time * frequency)

  399. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)

  400. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)

  401. RightHip:SetDesiredAngle(-desiredAngle)

  402. LeftHip:SetDesiredAngle(-desiredAngle)

  403. end

  404. -- Tool Animation handling

  405. local tool = getTool()

  406. if tool and tool:FindFirstChild("Handle") then

  407. local animStringValueObject = getToolAnim(tool)

  408. if animStringValueObject then

  409. toolAnim = animStringValueObject.Value

  410. -- message recieved, delete StringValue

  411. animStringValueObject.Parent = nil

  412. toolAnimTime = time + .3

  413. end

  414. if time > toolAnimTime then

  415. toolAnimTime = 0

  416. toolAnim = "None"

  417. end

  418. animateTool()

  419. else

  420. stopToolAnimations()

  421. toolAnim = "None"

  422. toolAnimInstance = nil

  423. toolAnimTime = 0

  424. end

  425. end

  426. -- connect events

  427. Humanoid.Died:connect(onDied)

  428. Humanoid.Running:connect(onRunning)

  429. Humanoid.Jumping:connect(onJumping)

  430. Humanoid.Climbing:connect(onClimbing)

  431. Humanoid.GettingUp:connect(onGettingUp)

  432. Humanoid.FreeFalling:connect(onFreeFall)

  433. Humanoid.FallingDown:connect(onFallingDown)

  434. Humanoid.Seated:connect(onSeated)

  435. Humanoid.PlatformStanding:connect(onPlatformStanding)

  436. Humanoid.Swimming:connect(onSwimming)

  437. -- setup emote chat hook

  438. game:GetService("Players").LocalPlayer.Chatted:connect(function(msg)

  439. local emote = ""

  440. if msg == "/e dance" then

  441. emote = dances[math.random(1, #dances)]

  442. elseif (string.sub(msg, 1, 3) == "/e ") then

  443. emote = string.sub(msg, 4)

  444. elseif (string.sub(msg, 1, 7) == "/emote ") then

  445. emote = string.sub(msg, 8)

  446. end

  447. if (pose == "Standing" and emoteNames[emote] ~= nil) then

  448. playAnimation(emote, 0.1, Humanoid)

  449. end

  450. end)

  451. -- main program

  452. -- initialize to idle

  453. playAnimation("idle", 0.1, Humanoid)

  454. pose = "Standing"

  455. while Figure.Parent ~= nil do

  456. local _, time = wait(0.1)

  457. move(time)

  458. end

  459. if Humanoid.Health == 0

  460. then

  461. print("death occured, waiting for respawn")

  462. Figure:WaitForChild("Humanoid")

  463. print("making r6 again")

  464. oof()

  465. end

  466. end

  467. oof()

r6 script - Pastebin.com (2024)
Top Articles
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 5638

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.