Advertisement
sIendytubble

SWITCHED - Minecraft Steve Script

Feb 16th, 2020
4,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.92 KB | None | 0 0
  1. --[[
  2. Hey, thanks for using my steve script!
  3. i just got to let you know something if you just used it.
  4. this will NOT work on any script builder that i know of
  5. the only game i know it will not work on is voidacity's script builder.
  6. but.
  7. this will work on a few games.
  8. i only know one that this script works on
  9. https://www.roblox.com/games/2577003352
  10. its called Insert Wars Remade
  11. its a game where you can insert any free model on the library
  12. and execute script builder scripts aswell
  13. all you have to do is open the insert tool
  14. click the Execute tab
  15. then put a RAW pastebin link in there.
  16. btw.
  17. scripts without a fe converter like mine wont work with fe
  18. so if you want to run it as local
  19. go to the bottom right corner of the execute tab window
  20. press localscript
  21. or if you have an fe script and you want to use it
  22. press script if its not already at script
  23. then you can use my steve script!
  24. have fun!
  25. (if you did not get what i said then watch this quick video then you'll get how it works and how to use it. https://www.youtube.com/watch?v=2X_0E_kQa38)
  26. --]]
  27. --https://github.com/Mokiros/roblox-FE-compatibility
  28. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  29. local Player,game,owner = owner,game
  30. local RealPlayer = Player
  31. do
  32. print("FE Compatibility code V2 by Mokiros")
  33. local RealPlayer = RealPlayer
  34. script.Parent = RealPlayer.Character
  35.  
  36. --Fake event to make stuff like Mouse.KeyDown work
  37. local Disconnect_Function = function(this)
  38. this[1].Functions[this[2]] = nil
  39. end
  40. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  41. local FakeEvent_Metatable = {__index={
  42. Connect = function(this,f)
  43. local i = tostring(math.random(0,10000))
  44. while this.Functions[i] do
  45. i = tostring(math.random(0,10000))
  46. end
  47. this.Functions[i] = f
  48. return setmetatable({this,i},Disconnect_Metatable)
  49. end
  50. }}
  51. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  52. local function fakeEvent()
  53. return setmetatable({Functions={}},FakeEvent_Metatable)
  54. end
  55.  
  56. --Creating fake input objects with fake variables
  57. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  58. FakeMouse.keyUp = FakeMouse.KeyUp
  59. FakeMouse.keyDown = FakeMouse.KeyDown
  60. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  61. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  62. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  63. end}
  64. --Merged 2 functions into one by checking amount of arguments
  65. CAS.UnbindAction = CAS.BindAction
  66.  
  67. --This function will trigger the events that have been :Connect()'ed
  68. local function TriggerEvent(self,ev,...)
  69. for _,f in pairs(self[ev].Functions) do
  70. f(...)
  71. end
  72. end
  73. FakeMouse.TriggerEvent = TriggerEvent
  74. UIS.TriggerEvent = TriggerEvent
  75.  
  76. --Client communication
  77. local Event = Instance.new("RemoteEvent")
  78. Event.Name = "UserInput_Event"
  79. Event.OnServerEvent:Connect(function(plr,io)
  80. if plr~=RealPlayer then return end
  81. FakeMouse.Target = io.Target
  82. FakeMouse.Hit = io.Hit
  83. if not io.isMouse then
  84. local b = io.UserInputState == Enum.UserInputState.Begin
  85. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  86. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  87. end
  88. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  89. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  90. end
  91. for _,t in pairs(CAS.Actions) do
  92. for _,k in pairs(t.Keys) do
  93. if k==io.KeyCode then
  94. t.Function(t.Name,io.UserInputState,io)
  95. end
  96. end
  97. end
  98. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  99. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  100. end
  101. end)
  102. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  103. local Mouse = owner:GetMouse()
  104. local UIS = game:GetService("UserInputService")
  105. local input = function(io,RobloxHandled)
  106. if RobloxHandled then return end
  107. --Since InputObject is a client-side instance, we create and pass table instead
  108. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  109. end
  110. UIS.InputBegan:Connect(input)
  111. UIS.InputEnded:Connect(input)
  112.  
  113. local h,t
  114. --Give the server mouse data every second frame, but only if the values changed
  115. --If player is not moving their mouse, client won't fire events
  116. local HB = game:GetService("RunService").Heartbeat
  117. while true do
  118. if h~=Mouse.Hit or t~=Mouse.Target then
  119. h,t=Mouse.Hit,Mouse.Target
  120. Event:FireServer({isMouse=true,Target=t,Hit=h})
  121. end
  122. --Wait 2 frames
  123. for i=1,2 do
  124. HB:Wait()
  125. end
  126. end]==],script)
  127.  
  128. ----Sandboxed game object that allows the usage of client-side methods and services
  129. --Real game object
  130. local RealGame = game
  131.  
  132. --Metatable for fake service
  133. local FakeService_Metatable = {
  134. __index = function(self,k)
  135. local s = rawget(self,"_RealService")
  136. if s then
  137. return typeof(s[k])=="function"
  138. and function(_,...)return s[k](s,...)end or s[k]
  139. end
  140. end,
  141. __newindex = function(self,k,v)
  142. local s = rawget(self,"_RealService")
  143. if s then s[k]=v end
  144. end
  145. }
  146. local function FakeService(t,RealService)
  147. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  148. return setmetatable(t,FakeService_Metatable)
  149. end
  150.  
  151. --Fake game object
  152. local FakeGame = {
  153. GetService = function(self,s)
  154. return rawget(self,s) or RealGame:GetService(s)
  155. end,
  156. Players = FakeService({
  157. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  158. },"Players"),
  159. UserInputService = FakeService(UIS,"UserInputService"),
  160. ContextActionService = FakeService(CAS,"ContextActionService"),
  161. RunService = FakeService({
  162. _btrs = {},
  163. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  164. BindToRenderStep = function(self,name,_,fun)
  165. self._btrs[name] = self.Heartbeat:Connect(fun)
  166. end,
  167. UnbindFromRenderStep = function(self,name)
  168. self._btrs[name]:Disconnect()
  169. end,
  170. },"RunService")
  171. }
  172. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  173. FakeGame.service = FakeGame.GetService
  174. FakeService(FakeGame,game)
  175. --Changing owner to fake player object to support owner:GetMouse()
  176. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  177. end
  178. -- ORIGINAL CREATOR: Depr1
  179. --Fixed lags by stommmDev for toasters if the creator wants to shut down this script i will
  180. -- If this script isn't on pastebin or the user who uploaded this isn't called "Delros12"
  181. -- (and yes my pastebin account is Delros12) or the link is not https://pastebin.com/2NNDTLjL
  182. -- then this is not the original link of this script.
  183.  
  184. -- The original link of the script gets edited constantly for updates, if you use the original
  185. -- link you will be able to enjoy the most recent updates of this script without changing to
  186. -- another link which contains updated script.
  187. --[[
  188. if you scrolled down here then the original link doesnt actually get updated alot execept for this one.
  189. the original creator is more into game developing and stuff.
  190. --]]
  191.  
  192. -- Enjoy! :)
  193.  
  194. -- Controls: Q to sneak, use the keypad numbers 1-9 to change blocks, choose a empty slot i
  195. -- you want to remove a block.
  196.  
  197. -- this script will transform you into steve when used
  198.  
  199. local targetName = owner.Name
  200. local player = game.Players:FindFirstChild(targetName)
  201.  
  202. function putTexture(part, frontF, backF, topF, bottomF, leftF, rightF, className)
  203. local faces = {"Front", "Back", "Top", "Bottom", "Left", "Right"}
  204. for i,f in pairs(faces) do
  205. local decal = Instance.new(className, part)
  206. if i == 1 then decal.Texture = frontF decal.Name = f end
  207. if i == 2 then decal.Texture = backF or frontF decal.Name = f end
  208. if i == 3 then decal.Texture = topF or frontF decal.Name = f end
  209. if i == 4 then decal.Texture = bottomF or frontF decal.Name = f end
  210. if i == 5 then decal.Texture = leftF or frontF decal.Name = f end
  211. if i == 6 then decal.Texture = rightF or frontF decal.Name = f end
  212. decal.Face = f
  213. end
  214. return part
  215. end
  216. function makeSquare(position, size, color, transparency, parent)
  217. end
  218. function putToolBarSlot(position, image)
  219. local playerGui = player:FindFirstChild("PlayerGui")
  220. if playerGui then
  221. end
  222. end
  223. function divide(x, d)
  224. if x ~= 0 and d ~= 0 then
  225. return x/d
  226. else
  227. return x
  228. end
  229. end -- so it doesn't divide by zero
  230. function getDistance(v1, v2)
  231. return math.abs((Vector3.new(math.abs(v2.X - v1.X), math.abs(v2.Y - v1.Y), math.abs(v2.Z - v1.Z))).Magnitude)
  232. end
  233. function round(x)
  234. if x%2 ~= 0.5 then
  235. return math.floor(x+0.5)
  236. end
  237. return x-0.5
  238. end
  239. function weldTo(part1, part2)
  240. local weld = Instance.new("Weld", part1)
  241. weld.Part0 = part1
  242. weld.Part1 = part2
  243. end
  244. function getMagnitudeXZ(velocity)
  245. return math.abs(velocity.X) + math.abs(velocity.Z)
  246. end
  247. function placeBlock(block, cFPos)
  248. end
  249. local toolBar = {
  250. }
  251. if player then
  252. local char = player.Character
  253. minecrafttheme = Instance.new("Sound",char)
  254. minecrafttheme.SoundId = "rbxassetid://4611987152"
  255. minecrafttheme.Volume = 3
  256. minecrafttheme:Play()
  257. minecrafttheme.Looped = true
  258. if char then
  259. for _,cM in pairs(char:GetChildren()) do
  260. if cM.ClassName == "CharacterMesh" then cM:Destroy() end
  261. end
  262.  
  263. --[]
  264. local gui = player.PlayerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", player.PlayerGui)
  265. gui.Name = "ToolBar"
  266.  
  267. makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 364, 0, 44),
  268. Color3.new(0/255, 0/255, 0/255), 0, gui)
  269.  
  270. local blocks = {"Dirt", "Grass", "Stone", "Diamond_Ore", "Diamond_Block", "Wood_Planks", "Oak_Log"}
  271. for i = 1, 9 do
  272. if toolBar[blocks[i]] ~= nil then
  273. putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), toolBar[blocks[i]].frontTex)
  274. else
  275. putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), "")
  276. end
  277. end
  278.  
  279. local humRootPart = char:WaitForChild("HumanoidRootPart")
  280. local head = char:WaitForChild("Head")
  281. local torso = char:WaitForChild("Torso")
  282. local lArm = char:WaitForChild("Left Arm")
  283. local rArm = char:WaitForChild("Right Arm")
  284. local lLeg = char:WaitForChild("Left Leg")
  285. local rLeg = char:WaitForChild("Right Leg")
  286.  
  287. head.Size = Vector3.new(1.3, 1.3, 1.3)
  288. putTexture(head, "rbxassetid://38738031", "rbxassetid://36047330",
  289. "rbxassetid://36047341", "rbxassetid://36047347",
  290. "rbxassetid://36047323", "rbxassetid://36047315", "Decal")
  291. head:WaitForChild("Mesh"):Destroy()
  292. head:WaitForChild("face"):Destroy()
  293.  
  294. torso.Size = Vector3.new(1.3, 1.95, 0.65)
  295. putTexture(torso, "rbxassetid://38934753", "rbxassetid://38934731",
  296. "rbxassetid://38934780", "rbxassetid://38934740",
  297. "rbxassetid://38934762", "rbxassetid://38934762", "Decal")
  298.  
  299. lArm.Size = Vector3.new(0.65, 1.95, 0.65)
  300. putTexture(lArm, "rbxassetid://38934581", "rbxassetid://38934560",
  301. "rbxassetid://38934613", "rbxassetid://38934568",
  302. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  303.  
  304. rArm.Size = Vector3.new(0.65, 1.95, 0.65)
  305. putTexture(rArm, "rbxassetid://38934560", "rbxassetid://38934581",
  306. "rbxassetid://38934613", "rbxassetid://38934568",
  307. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  308.  
  309. lLeg.Size = Vector3.new(0.65, 1.95, 0.65)
  310. putTexture(lLeg, "rbxassetid://38936226", "rbxassetid://38936209",
  311. "rbxassetid://38934719", "rbxassetid://38934712",
  312. "rbxassetid://38936255", "rbxassetid://38936242", "Decal")
  313.  
  314. rLeg.Size = Vector3.new(0.65, 1.95, 0.65)
  315. putTexture(rLeg, "rbxassetid://38936209", "rbxassetid://38936226",
  316. "rbxassetid://38934719", "rbxassetid://38934712",
  317. "rbxassetid://38936242", "rbxassetid://38936255", "Decal")
  318.  
  319. char.Humanoid:ClearAllChildren()
  320. char.Animate:Remove()
  321.  
  322. -- now for the real stuff
  323. -- |
  324. -- |
  325. -- V
  326. Instance.new("BlockMesh", torso)
  327. Instance.new("BlockMesh", lArm)
  328. Instance.new("BlockMesh", rArm)
  329. Instance.new("BlockMesh", lLeg)
  330. Instance.new("BlockMesh", rLeg)
  331.  
  332. local camera = workspace.CurrentCamera
  333. local camPart = Instance.new("Part", game.Lighting)
  334. camPart.Size = Vector3.new(0, 0, 0)
  335. camPart.CFrame = camera.CoordinateFrame
  336. camPart.Transparency = 1
  337. camPart.Anchored = true
  338.  
  339. --[[local cameraHand = Instance.new("Part", camera)
  340. cameraHand.Size = Vector3.new(0.65, 1.95, 0.65)
  341. cameraHand.CanCollide = false
  342. cameraHand.Anchored = true
  343. cameraHand.Name = "CameraHand"
  344. putTexture(cameraHand, "rbxassetid://38934560", "rbxassetid://38934581",
  345. "rbxassetid://38934613", "rbxassetid://38934568",
  346. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  347.  
  348. local cameraHandWeld = Instance.new("Motor6D", camPart)
  349. cameraHandWeld.Part0 = camPart
  350. cameraHandWeld.Part1 = cameraHand
  351. cameraHandWeld.C0 = CFrame.new(5, 0, 0)
  352. ]]--
  353.  
  354. local humanoid = char:WaitForChild("Humanoid")
  355.  
  356. humanoid.BreakJointsOnDeath = false
  357. humanoid.HipHeight = 0.3
  358.  
  359. local rootJoint = Instance.new("Motor6D", torso)
  360. rootJoint.Name = "RootJoint"
  361. rootJoint.Part0 = humRootPart
  362. rootJoint.Part1 = torso
  363. rootJoint.C1 = CFrame.new(0, 0.05, 0)
  364.  
  365. local neck = Instance.new("Motor6D", torso)
  366. neck.Name = "Neck"
  367. neck.Part0 = head
  368. neck.Part1 = torso
  369.  
  370. local lS = Instance.new("Motor6D", torso)
  371. lS.Name = "Left Shoulder"
  372. lS.Part0 = lArm
  373. lS.Part1 = torso
  374. lS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  375. lS.C1 = CFrame.new(0.65, 0.975, 0)
  376.  
  377. local rS = Instance.new("Motor6D", torso)
  378. rS.Name = "Right Shoulder"
  379. rS.Part0 = rArm
  380. rS.Part1 = torso
  381. rS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  382. rS.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
  383.  
  384. local lH = Instance.new("Motor6D", torso)
  385. lH.Name = "Left Hip"
  386. lH.Part0 = lLeg
  387. lH.Part1 = torso
  388. lH.C0 = CFrame.new(0, 0.975, 0)
  389. lH.C1 = CFrame.new(0.325, -0.975, 0) * CFrame.Angles(0, 0, 0)
  390.  
  391. local rH = Instance.new("Motor6D", torso)
  392. rH.Name = "Right Hip"
  393. rH.Part0 = rLeg
  394. rH.Part1 = torso
  395. rH.C0 = CFrame.new(0, 0.975, 0)
  396. rH.C1 = CFrame.new(-0.325, -0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
  397.  
  398. for _,p in pairs(char:GetChildren()) do
  399. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  400. local hit = Instance.new("Part", char)
  401. hit.Name = "DamagePart"
  402. if p.Name == "Right Arm" then
  403. hit.Name = "Rightarmdamagepoint"
  404. end
  405. hit.BrickColor = BrickColor.new("Bright red")
  406. hit.Material = "SmoothPlastic"
  407. hit.Transparency = 1
  408. hit.Size = Vector3.new(p.Size.X + .001, p.Size.Y + .001, p.Size.Z + .001)
  409. hit.CanCollide = false
  410. weldTo(hit, p)
  411. end
  412. end
  413.  
  414. wait(0.25)
  415.  
  416. local billNameTag = Instance.new("BillboardGui", char)
  417. billNameTag.Size = UDim2.new(1, 0, 1, 0)
  418. billNameTag.Adornee = head
  419. billNameTag.PlayerToHideFrom = player
  420.  
  421. local textLabel = Instance.new("TextLabel", billNameTag)
  422. textLabel.Font = "Arcade"
  423. --textLabel.Size = UDim2.new(1, 0, 1, 0)
  424. textLabel.TextScaled = true
  425. --textLabel.TextSize = 100
  426. textLabel.Text = targetName
  427. textLabel.Size = UDim2.new(textLabel.TextBounds.X/100, 0, 0.75, 0)
  428. textLabel.BorderSizePixel = 0
  429. textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  430. textLabel.TextColor3 = Color3.new(1, 1, 1)
  431. textLabel.BackgroundTransparency = 0.5
  432.  
  433. if textLabel.Text == "ManDuoMon" then
  434. textLabel.TextColor3 = Color3.new(1, 0.75, 0)
  435. end
  436.  
  437. billNameTag.SizeOffset = Vector2.new(-textLabel.TextBounds.X/200 + 0.5, 0)
  438. billNameTag.StudsOffset = Vector3.new(0, 1.5, 0)
  439.  
  440.  
  441. local ticks = 0
  442. local times = 0
  443.  
  444. local walkAnim = 0
  445. local increaseWalkAnim = 1
  446.  
  447. local idleAnimRotX = 0
  448. local idleAnimRotZ = 0
  449. local sneaking = 0
  450.  
  451. local RS = game:GetService("RunService").RenderStepped
  452. local Mouse = player:GetMouse()
  453.  
  454. local oldHP = humanoid.Health
  455.  
  456. local damageTime = 0
  457.  
  458. local punchRotX = 0
  459. local punchRotY = 0
  460. local punchRotZ = 0
  461. local punchSpeed = 0
  462. local punching = 0
  463. local punchEnded = 1
  464.  
  465. local sound = Instance.new("Sound", char)
  466. sound.Name = "Hurt"
  467. sound.Volume = 10
  468. sound.SoundId = "rbxassetid://3362346832"
  469. if humanoid.Health < oldHP then
  470. damageTime = 60
  471. sound:Play()
  472. end
  473.  
  474. local facesToResize = {"Front", "Back", "Left", "Right", "Bottom", "Top"}
  475. Mouse.Button1Down:connect(function()
  476. if punchEnded == 1 then punching = 1 end
  477. if Mouse.Target then
  478. if getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then
  479. local humanoid = Mouse.Target.Parent:FindFirstChild("Humanoid")
  480. if humanoid then
  481. humanoid.Health = humanoid.Health - 35
  482. humanoid.Health:TakeDamage(35)
  483. local parts = Mouse.Target.Parent:GetChildren()
  484. for _,p in pairs(parts) do
  485. if p.ClassName == "Part" then
  486. p.Velocity = Vector3.new(p.Velocity.X + (head.CFrame.lookVector.X * 18), p.Velocity.Y + (head.CFrame.lookVector.Y * 18) + 8, p.Velocity.Z + (head.CFrame.lookVector.Z * 18))
  487. end
  488. end
  489. return
  490. end
  491. local x = Mouse.Target.CFrame.p.X
  492. local y = Mouse.Target.CFrame.p.Y
  493. local z = Mouse.Target.CFrame.p.Z
  494. if Mouse.TargetSurface.Name == "Right" then x = x + 2.6 end
  495. if Mouse.TargetSurface.Name == "Left" then x = x - 2.6 end
  496. if Mouse.TargetSurface.Name == "Top" then y = y + 2.6 end
  497. if Mouse.TargetSurface.Name == "Bottom" then y = y - 2.6 end
  498. if Mouse.TargetSurface.Name == "Back" then z = z + 2.6 end
  499. if Mouse.TargetSurface.Name == "Front" then z = z - 2.6 end
  500. if Mouse.Target.Size.X > 2.6 or Mouse.Target.Size.Y > 2.6 or Mouse.Target.Size.Z > 2.6 then
  501. x = Mouse.Hit.p.X
  502. y = Mouse.Hit.p.Y
  503. z = Mouse.Hit.p.Z
  504. end
  505. -- local x = round(math.abs(mouseX)/2.6)*2.6
  506. -- local y = round(math.abs(mouseY)/2.6)*2.6
  507. -- local z = round(math.abs(mouseZ)/2.6)*2.6
  508. -- if Mouse.Hit.p.X < 0 then x = x * -1 end
  509. -- if Mouse.Hit.p.Y < 0 then y = y * -1 end
  510. -- if Mouse.Hit.p.Z < 0 then z = z * -1 end
  511. end
  512. end
  513. end)
  514.  
  515. -- selection thingy
  516. --
  517. Mouse.KeyDown:connect(function(key)
  518. if key == "q" then
  519. sneaking = 1
  520. humanoid.WalkSpeed = humanoid.WalkSpeed / 2
  521. rootJoint.C1 = CFrame.Angles(math.rad(sneaking*25), 0, 0)
  522. neck.C1 = CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*25)), 0, 0)
  523. lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*25), 0, 0)
  524. rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*25), 0, 0)
  525. --print("Sneaking...")
  526. end
  527. end)
  528.  
  529. Mouse.KeyUp:connect(function(key)
  530. if key == "q" then
  531. sneaking = 0
  532. humanoid.WalkSpeed = humanoid.WalkSpeed * 2
  533. humanoid.HipHeight = 0.3
  534. rootJoint.C1 = CFrame.new(0, 0.05, 0) * CFrame.Angles(0, 0, 0)
  535. lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
  536. rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
  537. --print("Stopped sneaking...")
  538. end
  539. end)
  540. dead = false
  541. while RS:wait() do
  542. if humanoid.Health < oldHP then
  543. damageTime = 60
  544. sound:Play()
  545. end
  546. oldHP = humanoid.Health
  547. if damageTime > 0 and humanoid.Health > 0 then
  548. for _,p in pairs(char:GetChildren()) do
  549. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  550. if p.Name == "DamagePart" then
  551. p.Transparency = 0.5
  552. end
  553. end
  554. end
  555. damageTime = damageTime - 2
  556. if damageTime <= 0 then
  557. for _,p in pairs(char:GetChildren()) do
  558. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  559. if p.Name == "DamagePart" then
  560. p.Transparency = 1
  561. end
  562. end
  563. end
  564. end
  565. end
  566. neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(torso.Orientation.X - (sneaking*0)), 0, 0)
  567. neck.C0 = CFrame.new(0, -0.65, 0)
  568. if humanoid.Health <= 0 and dead == false then
  569. dead = true
  570. local corpseCF = humRootPart.CFrame + Vector3.new(0, -2.925, 0)
  571. local corpse = Instance.new("Part", workspace)
  572. corpse.Anchored = true
  573. corpse.Name = "Dead Corpse"
  574. target = char
  575. target.Archivable = true
  576. playercorpse = target:Clone()
  577. playercorpse.Parent = corpse
  578. for i,v in pairs(playercorpse:GetChildren()) do
  579. if v.Name == "Rightarmdamagepoint" and v.Name == "DamagePart" then
  580. v:Destroy()
  581. end
  582. end
  583. corpse.Size = Vector3.new(3, 1, 3)
  584. corpse.CFrame = corpseCF
  585. corpse.Transparency = 1
  586. corpse.CustomPhysicalProperties = PhysicalProperties.new(1, 1, 0, 1, 1)
  587.  
  588. local dHead = playercorpse.Head
  589. dHead.CanCollide = false
  590. dHead.Material = "Fabric"
  591.  
  592. local dTorso = playercorpse.Torso
  593. dTorso.CanCollide = false
  594.  
  595. local dLArm = playercorpse["Left Arm"]
  596. dLArm.CanCollide = false
  597.  
  598. local dRArm = playercorpse["Right Arm"]
  599. dRArm.CanCollide = false
  600.  
  601. local dLLeg = playercorpse["Right Leg"]
  602. dLLeg.CanCollide = false
  603.  
  604. local dRLeg = playercorpse["Right Leg"]
  605. dRLeg.CanCollide = false
  606. weldCorpse = Instance.new("Weld",corpse)
  607. weldCorpse.Part0 = dTorso
  608. weldCorpse.Part1 = corpse
  609. weldCorpse.C0 = CFrame.new(0, -1.95 - 0.4, 0)
  610.  
  611. -- lazy naming...
  612.  
  613.  
  614. for _,p in pairs(playercorpse:GetChildren()) do
  615. if p.ClassName == "Part" then
  616. local hit = Instance.new("Part", p)
  617. hit.Name = "DamagePart"
  618. hit.BrickColor = BrickColor.new("Bright red")
  619. hit.Material = "SmoothPlastic"
  620. hit.Transparency = 0.5
  621. hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05)
  622. hit.CanCollide = false
  623. weldTo(hit, p)
  624. end
  625. end
  626.  
  627. head.Parent = nil
  628. torso.Parent = nil
  629. lArm.Parent = nil
  630. rArm.Parent = nil
  631. lLeg.Parent = nil
  632. rLeg.Parent = nil
  633.  
  634. weldTo(dTorso, humRootPart)
  635.  
  636. for i = 1, 55 do
  637. corpse.CFrame = corpseCF --*
  638. --CFrame.Angles(math.rad(-corpse.Orientation.X), 0, math.rad(-corpse.Orientation.Z))
  639.  
  640. weldCorpse.C1 = weldCorpse.C1:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, math.rad(90)), 0.075)
  641. RS:wait()
  642. end
  643. for _,p in pairs(corpse:GetChildren()) do
  644. p:Destroy()
  645. end
  646.  
  647. corpse.Anchored = true
  648.  
  649. local smoke = Instance.new("ParticleEmitter", corpse)
  650. smoke.Size = NumberSequence.new({
  651. NumberSequenceKeypoint.new(0, 0.6),
  652. NumberSequenceKeypoint.new(1, 0.6)
  653. })
  654. smoke.Texture = "rbxassetid://1494734425"
  655. smoke.Rate = 100
  656. smoke.Lifetime = NumberRange.new(0.6, 1.2)
  657. smoke.Speed = NumberRange.new(2, 5)
  658. smoke.SpreadAngle = Vector2.new(-30, 30)
  659.  
  660. wait(0.07)
  661.  
  662. smoke.Enabled = false
  663.  
  664. wait(2)
  665.  
  666. corpse:Destroy()
  667. print("You died!")
  668. end
  669. if getMagnitudeXZ(torso.Velocity) > 1 then
  670. if walkAnim >= 1 then
  671. increaseWalkAnim = -1
  672. elseif walkAnim <= -1 then
  673. increaseWalkAnim = 1
  674. end
  675. walkAnim = walkAnim + (increaseWalkAnim/(10+(sneaking*20)))
  676. else
  677. walkAnim = 0
  678. end
  679. --lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
  680. --rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  681. lH.C0 = lH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), -math.rad(sneaking*25) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, 0), 0.15)
  682. rH.C0 = rH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), math.rad(sneaking*25) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, 0), 0.15)
  683. --
  684. --rootJoint.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
  685. --print(math.abs(head.Orientation.Y) - math.abs(humRootPart.Orientation.Y))
  686. --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) > 45 then
  687. --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(-45 + head.Orientation.Y), 0)
  688. --print("-45")
  689. --end
  690. --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) < -45 then
  691. --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(45 + head.Orientation.Y), 0)
  692. --print("45")
  693. --end
  694.  
  695. --move these arms
  696. rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*25), math.rad(punchRotY), 0), 0.2)
  697.  
  698. rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*25), math.rad(punchRotY), 0), 0.2)
  699.  
  700. lS.C0 = lS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), idleAnimRotX/20 + math.rad(punchRotX) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, math.rad(punchRotZ) + idleAnimRotZ/20), 0.025+(math.min(1, getMagnitudeXZ(torso.Velocity))/12)*2 + divide(punchSpeed, 6) + hi)
  701. rS.C0 = rS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), idleAnimRotX/20 + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, idleAnimRotZ/20), 0.025+(math.min(1, getMagnitudeXZ(torso.Velocity))/12)*2)
  702. if punching == 1 and punchEnded == 1 then
  703. punching = 0
  704. --print("steve uses punch!!")
  705. local coPunch = coroutine.wrap(function()
  706. punchEnded = 0
  707. punchSpeed = 1
  708. punchRotX = -60
  709. punchRotY = -8
  710. punchRotZ = -35
  711. wait(0.075)
  712. punchSpeed = 1
  713. punchRotX = -75
  714. punchRotY = 8
  715. punchRotZ = 40
  716. wait(0.075)
  717. punchSpeed = 1
  718. punchRotX = -20
  719. punchRotZ = 40
  720. wait(0.075)
  721. punchSpeed = 3.5
  722. punchRotX = 0
  723. punchRotY = 0
  724. punchRotZ = 0
  725. punchEnded = 1
  726. wait(0.06)
  727. punchSpeed = 0
  728. end)
  729. coPunch()
  730. end
  731. if ticks > 20 then
  732. ticks = 0
  733. if times == 0 then
  734. times = times + 1
  735. idleAnimRotX = -1
  736. idleAnimRotZ = 0
  737. elseif times == 1 then
  738. times = times + 1
  739. idleAnimRotX = -0.75
  740. idleAnimRotZ = -0.75
  741. elseif times == 2 then
  742. times = times + 1
  743. idleAnimRotX = 0
  744. idleAnimRotZ = -1
  745. elseif times == 3 then
  746. times = times + 1
  747. idleAnimRotX = 0.75
  748. idleAnimRotZ = -0.75
  749. --idleAnimRotX = 0.75
  750. --idleAnimRotZ = -0
  751. elseif times == 4 then
  752. times = times + 1
  753. idleAnimRotX = 1
  754. idleAnimRotZ = 0
  755. --idleAnimRotX = 1
  756. --idleAnimRotZ = 0
  757. elseif times == 5 then
  758. times = times + 1
  759. idleAnimRotX = 0.75
  760. idleAnimRotZ = 0.75
  761. elseif times == 6 then
  762. times = times + 1
  763. idleAnimRotX = 0
  764. idleAnimRotZ = 1
  765. elseif times == 7 then
  766. times = 0
  767. idleAnimRotX = -0.75
  768. idleAnimRotZ = 0.75
  769. end
  770. end
  771. if hi == 1 then hi = 0 end
  772. ticks = ticks + 1
  773. end
  774. end
  775.  
  776. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement