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 | ||
| 148 | -- ORIGINAL CREATOR: Depr1 | |
| 149 | --Fixed lags by stommmDev for toasters if the creator wants to shut down this script i will | |
| 150 | -- If this script isn't on pastebin or the user who uploaded this isn't called "Delros12" | |
| 151 | -- (and yes my pastebin account is Delros12) or the link is not https://pastebin.com/2NNDTLjL | |
| 152 | -- then this is not the original link of this script. | |
| 153 | ||
| 154 | -- The original link of the script gets edited constantly for updates, if you use the original | |
| 155 | -- link you will be able to enjoy the most recent updates of this script without changing to | |
| 156 | -- another link which contains updated script. | |
| 157 | ||
| 158 | -- Enjoy! :) | |
| 159 | ||
| 160 | -- Controls: Q to sneak, use the keypad numbers 1-9 to change blocks, choose a empty slot i | |
| 161 | -- you want to remove a block. | |
| 162 | ||
| 163 | -- this script will transform you into steve when used | |
| 164 | ||
| 165 | local targetName = game.Players.LocalPlayer.Name | |
| 166 | local player = game.Players:FindFirstChild(targetName) | |
| 167 | function putTexture(part, frontF, backF, topF, bottomF, leftF, rightF, className) | |
| 168 | local faces = {"Front", "Back", "Top", "Bottom", "Left", "Right"}
| |
| 169 | for i,f in pairs(faces) do | |
| 170 | local decal = Instance.new(className, part) | |
| 171 | if i == 1 then decal.Texture = frontF decal.Name = f end | |
| 172 | if i == 2 then decal.Texture = backF or frontF decal.Name = f end | |
| 173 | if i == 3 then decal.Texture = topF or frontF decal.Name = f end | |
| 174 | if i == 4 then decal.Texture = bottomF or frontF decal.Name = f end | |
| 175 | if i == 5 then decal.Texture = leftF or frontF decal.Name = f end | |
| 176 | if i == 6 then decal.Texture = rightF or frontF decal.Name = f end | |
| 177 | decal.Face = f | |
| 178 | end | |
| 179 | return part | |
| 180 | end | |
| 181 | function makeSquare(position, size, color, transparency, parent) | |
| 182 | local label = Instance.new("TextLabel", parent)
| |
| 183 | label.Text = "" | |
| 184 | label.BorderSizePixel = 0 | |
| 185 | label.BackgroundTransparency = transparency | |
| 186 | label.Position = position | |
| 187 | label.Size = size | |
| 188 | label.BackgroundColor3 = color | |
| 189 | end | |
| 190 | function putToolBarSlot(position, image) | |
| 191 | local playerGui = player:FindFirstChild("PlayerGui")
| |
| 192 | if playerGui then | |
| 193 | local gui = playerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", playerGui)
| |
| 194 | gui.Name = "ToolBar" | |
| 195 | local slot = Instance.new("ImageLabel", gui)
| |
| 196 | slot.Position = position | |
| 197 | slot.Size = UDim2.new(0, 32, 0, 32) | |
| 198 | slot.BackgroundTransparency = 1 | |
| 199 | slot.ImageTransparency = 0 | |
| 200 | slot.Image = image | |
| 201 | slot.ZIndex = 2 | |
| 202 | ||
| 203 | makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 32, 0, 32), | |
| 204 | Color3.new(95/255, 89/255, 76/255), 0, slot) | |
| 205 | makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 32), | |
| 206 | Color3.new(0/255, 0/255, 0/255), 0.5, slot) | |
| 207 | makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 30, 0, 2), | |
| 208 | Color3.new(0/255, 0/255, 0/255), 0.5, slot) | |
| 209 | makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 36, 0, 2), | |
| 210 | Color3.new(106/255, 106/255, 106/255), 0, slot) | |
| 211 | makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 2, 0, 36), | |
| 212 | Color3.new(106/255, 106/255, 106/255), 0, slot) | |
| 213 | makeSquare(UDim2.new(0, 0, 0, 32), UDim2.new(0, 34, 0, 2), | |
| 214 | Color3.new(130/255, 130/255, 130/255), 0, slot) | |
| 215 | makeSquare(UDim2.new(0, 32, 0, 0), UDim2.new(0, 2, 0, 34), | |
| 216 | Color3.new(130/255, 130/255, 130/255), 0, slot) | |
| 217 | makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 2, 0, 38), | |
| 218 | Color3.new(130/255, 130/255, 130/255), 0, slot) | |
| 219 | makeSquare(UDim2.new(0, 34, 0, -2), UDim2.new(0, 2, 0, 36), | |
| 220 | Color3.new(106/255, 106/255, 106/255), 0, slot) | |
| 221 | makeSquare(UDim2.new(0, -2, 0, 34), UDim2.new(0, 38, 0, 2), | |
| 222 | Color3.new(106/255, 106/255, 106/255), 0, slot) | |
| 223 | makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 40, 0, 2), | |
| 224 | Color3.new(156/255, 156/255, 156/255), 0, slot) | |
| 225 | end | |
| 226 | end | |
| 227 | function divide(x, d) | |
| 228 | if x ~= 0 and d ~= 0 then | |
| 229 | return x/d | |
| 230 | else | |
| 231 | return x | |
| 232 | end | |
| 233 | end -- so it doesn't divide by zero | |
| 234 | function getDistance(v1, v2) | |
| 235 | return math.abs((Vector3.new(math.abs(v2.X - v1.X), math.abs(v2.Y - v1.Y), math.abs(v2.Z - v1.Z))).Magnitude) | |
| 236 | end | |
| 237 | function round(x) | |
| 238 | if x%2 ~= 0.5 then | |
| 239 | return math.floor(x+0.5) | |
| 240 | end | |
| 241 | return x-0.5 | |
| 242 | end | |
| 243 | function weldTo(part1, part2) | |
| 244 | local weld = Instance.new("Weld", part1)
| |
| 245 | weld.Part0 = part1 | |
| 246 | weld.Part1 = part2 | |
| 247 | end | |
| 248 | function getMagnitudeXZ(velocity) | |
| 249 | return math.abs(velocity.X) + math.abs(velocity.Z) | |
| 250 | end | |
| 251 | function placeBlock(block, cFPos) | |
| 252 | local blockPlaced = Instance.new("Part", workspace)
| |
| 253 | blockPlaced.Material = "Fabric" | |
| 254 | blockPlaced.Anchored = true | |
| 255 | blockPlaced.Size = block.size | |
| 256 | blockPlaced.CFrame = cFPos | |
| 257 | putTexture(blockPlaced, block.frontTex, block.backTex, | |
| 258 | block.topTex, block.bottomTex, block.leftTex, block.rightTex, "Texture") | |
| 259 | return blockPlaced | |
| 260 | end | |
| 261 | local toolBar = {
| |
| 262 | Dirt = {
| |
| 263 | size = Vector3.new(2.6, 2.6, 2.6), | |
| 264 | frontTex = "rbxassetid://179655033", | |
| 265 | backTex = "rbxassetid://179655033", | |
| 266 | topTex = "rbxassetid://179655033", | |
| 267 | bottomTex = "rbxassetid://179655033", | |
| 268 | leftTex = "rbxassetid://179655033", | |
| 269 | rightTex = "rbxassetid://179655033" | |
| 270 | }, | |
| 271 | Grass = {
| |
| 272 | size = Vector3.new(2.6, 2.6, 2.6), | |
| 273 | frontTex = "rbxassetid://96430337", | |
| 274 | backTex = "rbxassetid://96430337", | |
| 275 | topTex = "rbxassetid://96430265", | |
| 276 | bottomTex = "rbxassetid://179655033", | |
| 277 | leftTex = "rbxassetid://96430337", | |
| 278 | rightTex = "rbxassetid://96430337" | |
| 279 | }, | |
| 280 | Stone = {
| |
| 281 | size = Vector3.new(2.6, 2.6, 2.6), | |
| 282 | frontTex = "rbxassetid://75880927", | |
| 283 | backTex = "rbxassetid://75880927", | |
| 284 | topTex = "rbxassetid://75880927", | |
| 285 | bottomTex = "rbxassetid://75880927", | |
| 286 | leftTex = "rbxassetid://75880927", | |
| 287 | rightTex = "rbxassetid://75880927" | |
| 288 | }, | |
| 289 | Diamond_Ore = {
| |
| 290 | size = Vector3.new(2.6, 2.6, 2.6), | |
| 291 | frontTex = "rbxassetid://57928490", | |
| 292 | backTex = "rbxassetid://57928490", | |
| 293 | topTex = "rbxassetid://57928490", | |
| 294 | bottomTex = "rbxassetid://57928490", | |
| 295 | leftTex = "rbxassetid://57928490", | |
| 296 | rightTex = "rbxassetid://57928490" | |
| 297 | }, | |
| 298 | Diamond_Block = {
| |
| 299 | size = Vector3.new(2.6, 2.6, 2.6), | |
| 300 | frontTex = "rbxassetid://56749955", | |
| 301 | backTex = "rbxassetid://56749955", | |
| 302 | topTex = "rbxassetid://56749955", | |
| 303 | bottomTex = "rbxassetid://56749955", | |
| 304 | leftTex = "rbxassetid://56749955", | |
| 305 | rightTex = "rbxassetid://56749955" | |
| 306 | }, | |
| 307 | Wood_Planks = {
| |
| 308 | size = Vector3.new(2.6, 2.6, 2.6), | |
| 309 | frontTex = "rbxassetid://346201871", | |
| 310 | backTex = "rbxassetid://346201871", | |
| 311 | topTex = "rbxassetid://346201871", | |
| 312 | bottomTex = "rbxassetid://346201871", | |
| 313 | leftTex = "rbxassetid://346201871", | |
| 314 | rightTex = "rbxassetid://346201871" | |
| 315 | }, | |
| 316 | Oak_Log = {
| |
| 317 | size = Vector3.new(2.6, 2.6, 2.6), | |
| 318 | frontTex = "rbxassetid://310831812", | |
| 319 | backTex = "rbxassetid://310831812", | |
| 320 | topTex = "rbxassetid://152538557", | |
| 321 | bottomTex = "rbxassetid://152538557", | |
| 322 | leftTex = "rbxassetid://310831812", | |
| 323 | rightTex = "rbxassetid://310831812" | |
| 324 | } | |
| 325 | } | |
| 326 | if player then | |
| 327 | local char = player.Character | |
| 328 | if char then | |
| 329 | for _,cM in pairs(char:GetChildren()) do | |
| 330 | if cM.ClassName == "CharacterMesh" then cM:Destroy() end | |
| 331 | end | |
| 332 | ||
| 333 | --[] | |
| 334 | local gui = player.PlayerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", player.PlayerGui)
| |
| 335 | gui.Name = "ToolBar" | |
| 336 | ||
| 337 | makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 364, 0, 44), | |
| 338 | Color3.new(0/255, 0/255, 0/255), 0, gui) | |
| 339 | ||
| 340 | local blocks = {"Dirt", "Grass", "Stone", "Diamond_Ore", "Diamond_Block", "Wood_Planks", "Oak_Log"}
| |
| 341 | for i = 1, 9 do | |
| 342 | if toolBar[blocks[i]] ~= nil then | |
| 343 | putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), toolBar[blocks[i]].frontTex) | |
| 344 | else | |
| 345 | putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), "") | |
| 346 | end | |
| 347 | end | |
| 348 | ||
| 349 | local humRootPart = char:WaitForChild("HumanoidRootPart")
| |
| 350 | local head = char:WaitForChild("Head")
| |
| 351 | local torso = char:WaitForChild("Torso")
| |
| 352 | local lArm = char:WaitForChild("Left Arm")
| |
| 353 | local rArm = char:WaitForChild("Right Arm")
| |
| 354 | local lLeg = char:WaitForChild("Left Leg")
| |
| 355 | local rLeg = char:WaitForChild("Right Leg")
| |
| 356 | ||
| 357 | head.Size = Vector3.new(1.3, 1.3, 1.3) | |
| 358 | putTexture(head, "rbxassetid://38738031", "rbxassetid://36047330", | |
| 359 | "rbxassetid://36047341", "rbxassetid://36047347", | |
| 360 | "rbxassetid://36047323", "rbxassetid://36047315", "Decal") | |
| 361 | head:WaitForChild("Mesh"):Destroy()
| |
| 362 | head:WaitForChild("face"):Destroy()
| |
| 363 | ||
| 364 | torso.Size = Vector3.new(1.3, 1.95, 0.65) | |
| 365 | putTexture(torso, "rbxassetid://38934753", "rbxassetid://38934731", | |
| 366 | "rbxassetid://38934780", "rbxassetid://38934740", | |
| 367 | "rbxassetid://38934762", "rbxassetid://38934762", "Decal") | |
| 368 | ||
| 369 | lArm.Size = Vector3.new(0.65, 1.95, 0.65) | |
| 370 | putTexture(lArm, "rbxassetid://38934581", "rbxassetid://38934560", | |
| 371 | "rbxassetid://38934613", "rbxassetid://38934568", | |
| 372 | "rbxassetid://38934601", "rbxassetid://38934591", "Decal") | |
| 373 | ||
| 374 | rArm.Size = Vector3.new(0.65, 1.95, 0.65) | |
| 375 | putTexture(rArm, "rbxassetid://38934560", "rbxassetid://38934581", | |
| 376 | "rbxassetid://38934613", "rbxassetid://38934568", | |
| 377 | "rbxassetid://38934601", "rbxassetid://38934591", "Decal") | |
| 378 | ||
| 379 | lLeg.Size = Vector3.new(0.65, 1.95, 0.65) | |
| 380 | putTexture(lLeg, "rbxassetid://38936226", "rbxassetid://38936209", | |
| 381 | "rbxassetid://38934719", "rbxassetid://38934712", | |
| 382 | "rbxassetid://38936255", "rbxassetid://38936242", "Decal") | |
| 383 | ||
| 384 | rLeg.Size = Vector3.new(0.65, 1.95, 0.65) | |
| 385 | putTexture(rLeg, "rbxassetid://38936209", "rbxassetid://38936226", | |
| 386 | "rbxassetid://38934719", "rbxassetid://38934712", | |
| 387 | "rbxassetid://38936242", "rbxassetid://38936255", "Decal") | |
| 388 | ||
| 389 | char.Humanoid:ClearAllChildren() | |
| 390 | char.Animate:Remove() | |
| 391 | ||
| 392 | -- now for the real stuff | |
| 393 | -- | | |
| 394 | -- | | |
| 395 | -- V | |
| 396 | Instance.new("BlockMesh", torso)
| |
| 397 | Instance.new("BlockMesh", lArm)
| |
| 398 | Instance.new("BlockMesh", rArm)
| |
| 399 | Instance.new("BlockMesh", lLeg)
| |
| 400 | Instance.new("BlockMesh", rLeg)
| |
| 401 | ||
| 402 | local camera = workspace.Camera | |
| 403 | local camPart = Instance.new("Part", camera)
| |
| 404 | camPart.Size = Vector3.new(0, 0, 0) | |
| 405 | camPart.CFrame = camera.CFrame | |
| 406 | camPart.Transparency = 1 | |
| 407 | ||
| 408 | --[[local cameraHand = Instance.new("Part", camera)
| |
| 409 | cameraHand.Size = Vector3.new(0.65, 1.95, 0.65) | |
| 410 | cameraHand.CanCollide = false | |
| 411 | cameraHand.Anchored = true | |
| 412 | cameraHand.Name = "CameraHand" | |
| 413 | putTexture(cameraHand, "rbxassetid://38934560", "rbxassetid://38934581", | |
| 414 | "rbxassetid://38934613", "rbxassetid://38934568", | |
| 415 | "rbxassetid://38934601", "rbxassetid://38934591", "Decal") | |
| 416 | ||
| 417 | local cameraHandWeld = Instance.new("Motor6D", camPart)
| |
| 418 | cameraHandWeld.Part0 = camPart | |
| 419 | cameraHandWeld.Part1 = cameraHand | |
| 420 | cameraHandWeld.C0 = CFrame.new(5, 0, 0) | |
| 421 | ]]-- | |
| 422 | ||
| 423 | local humanoid = char:WaitForChild("Humanoid")
| |
| 424 | humanoid.HipHeight = 0.3 | |
| 425 | ||
| 426 | local rootJoint = Instance.new("Motor6D", torso)
| |
| 427 | rootJoint.Name = "RootJoint" | |
| 428 | rootJoint.Part0 = humRootPart | |
| 429 | rootJoint.Part1 = torso | |
| 430 | rootJoint.C1 = CFrame.new(0, 0.05, 0) | |
| 431 | ||
| 432 | local neck = Instance.new("Motor6D", torso)
| |
| 433 | neck.Name = "Neck" | |
| 434 | neck.Part0 = head | |
| 435 | neck.Part1 = torso | |
| 436 | ||
| 437 | local lS = Instance.new("Motor6D", torso)
| |
| 438 | lS.Name = "Left Shoulder" | |
| 439 | lS.Part0 = lArm | |
| 440 | lS.Part1 = torso | |
| 441 | lS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
| 442 | lS.C1 = CFrame.new(0.65, 0.975, 0) | |
| 443 | ||
| 444 | local rS = Instance.new("Motor6D", torso)
| |
| 445 | rS.Name = "Right Shoulder" | |
| 446 | rS.Part0 = rArm | |
| 447 | rS.Part1 = torso | |
| 448 | rS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
| 449 | rS.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0) | |
| 450 | ||
| 451 | local lH = Instance.new("Motor6D", torso)
| |
| 452 | lH.Name = "Left Hip" | |
| 453 | lH.Part0 = lLeg | |
| 454 | lH.Part1 = torso | |
| 455 | lH.C0 = CFrame.new(0, 0.975, 0) | |
| 456 | lH.C1 = CFrame.new(0.325, -0.975, 0) * CFrame.Angles(0, 0, 0) | |
| 457 | ||
| 458 | local rH = Instance.new("Motor6D", torso)
| |
| 459 | rH.Name = "Right Hip" | |
| 460 | rH.Part0 = rLeg | |
| 461 | rH.Part1 = torso | |
| 462 | rH.C0 = CFrame.new(0, 0.975, 0) | |
| 463 | rH.C1 = CFrame.new(-0.325, -0.975, 0) * CFrame.Angles(0, -math.rad(180), 0) | |
| 464 | ||
| 465 | for _,p in pairs(char:GetChildren()) do | |
| 466 | if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then | |
| 467 | local hit = Instance.new("Part", char)
| |
| 468 | hit.Name = "DamagePart" | |
| 469 | hit.BrickColor = BrickColor.new("Bright red")
| |
| 470 | hit.Material = "SmoothPlastic" | |
| 471 | hit.Transparency = 1 | |
| 472 | hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05) | |
| 473 | hit.CanCollide = false | |
| 474 | weldTo(hit, p) | |
| 475 | end | |
| 476 | end | |
| 477 | ||
| 478 | local ticks = 0 | |
| 479 | local times = 0 | |
| 480 | ||
| 481 | local walkAnim = 0 | |
| 482 | local increaseWalkAnim = 1 | |
| 483 | ||
| 484 | local idleAnimRotX = 0 | |
| 485 | local idleAnimRotZ = 0 | |
| 486 | local sneaking = 0 | |
| 487 | ||
| 488 | local RS = game:GetService("RunService").RenderStepped
| |
| 489 | local Mouse = player:GetMouse() | |
| 490 | ||
| 491 | local oldHP = humanoid.Health | |
| 492 | local damageTime = 0 | |
| 493 | ||
| 494 | local punchRotX = 0 | |
| 495 | local punchRotY = 0 | |
| 496 | local punchRotZ = 0 | |
| 497 | local punchSpeed = 0 | |
| 498 | local punching = 0 | |
| 499 | local selectedBlock = 8 | |
| 500 | local punchEnded = 1 | |
| 501 | local itemOnHand = nil | |
| 502 | ||
| 503 | local handItem = Instance.new("Part", char)
| |
| 504 | handItem.Name = "HandItem" | |
| 505 | handItem.Size = Vector3.new(0.52, 0.52, 0.52) | |
| 506 | handItem.Transparency = 1 | |
| 507 | handItem.CanCollide = false | |
| 508 | ||
| 509 | local handItemWeld = Instance.new("Weld", char)
| |
| 510 | handItemWeld.Part0 = handItem | |
| 511 | handItemWeld.Part1 = lArm | |
| 512 | handItemWeld.C1 = CFrame.new(0, -0.9, -0.6) * CFrame.Angles(math.rad(-10), math.rad(45), 0) | |
| 513 | ||
| 514 | local sound = Instance.new("Sound", char)
| |
| 515 | sound.Name = "Hurt" | |
| 516 | sound.Volume = 10 | |
| 517 | sound.SoundId = "rbxassetid://535690488" | |
| 518 | ||
| 519 | local facesToResize = {"Front", "Back", "Left", "Right", "Bottom", "Top"}
| |
| 520 | Mouse.Button1Down:connect(function() | |
| 521 | if punchEnded == 1 then punching = 1 end | |
| 522 | if Mouse.Target then | |
| 523 | if getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then | |
| 524 | local humanoid = Mouse.Target.Parent:FindFirstChild("Humanoid")
| |
| 525 | if humanoid then | |
| 526 | humanoid.Health = humanoid.Health - 10 | |
| 527 | local parts = Mouse.Target.Parent:GetChildren() | |
| 528 | for _,p in pairs(parts) do | |
| 529 | if p.ClassName == "Part" then | |
| 530 | 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)) | |
| 531 | end | |
| 532 | end | |
| 533 | return | |
| 534 | end | |
| 535 | local x = Mouse.Target.CFrame.p.X | |
| 536 | local y = Mouse.Target.CFrame.p.Y | |
| 537 | local z = Mouse.Target.CFrame.p.Z | |
| 538 | if Mouse.TargetSurface.Name == "Right" then x = x + 2.6 end | |
| 539 | if Mouse.TargetSurface.Name == "Left" then x = x - 2.6 end | |
| 540 | if Mouse.TargetSurface.Name == "Top" then y = y + 2.6 end | |
| 541 | if Mouse.TargetSurface.Name == "Bottom" then y = y - 2.6 end | |
| 542 | if Mouse.TargetSurface.Name == "Back" then z = z + 2.6 end | |
| 543 | if Mouse.TargetSurface.Name == "Front" then z = z - 2.6 end | |
| 544 | if Mouse.Target.Size.X > 2.6 or Mouse.Target.Size.Y > 2.6 or Mouse.Target.Size.Z > 2.6 then | |
| 545 | x = Mouse.Hit.p.X | |
| 546 | y = Mouse.Hit.p.Y | |
| 547 | z = Mouse.Hit.p.Z | |
| 548 | end | |
| 549 | -- local x = round(math.abs(mouseX)/2.6)*2.6 | |
| 550 | -- local y = round(math.abs(mouseY)/2.6)*2.6 | |
| 551 | -- local z = round(math.abs(mouseZ)/2.6)*2.6 | |
| 552 | -- if Mouse.Hit.p.X < 0 then x = x * -1 end | |
| 553 | -- if Mouse.Hit.p.Y < 0 then y = y * -1 end | |
| 554 | -- if Mouse.Hit.p.Z < 0 then z = z * -1 end | |
| 555 | if selectedBlock == 0 then | |
| 556 | local blk = placeBlock(toolBar.Dirt, CFrame.new(x, y, z)) | |
| 557 | for _,f in pairs(facesToResize) do | |
| 558 | blk:WaitForChild(f).StudsPerTileU = 2.6 | |
| 559 | blk:WaitForChild(f).StudsPerTileV = 2.6 | |
| 560 | end | |
| 561 | elseif selectedBlock == 1 then | |
| 562 | local blk = placeBlock(toolBar.Grass, CFrame.new(x, y, z)) | |
| 563 | for _,f in pairs(facesToResize) do | |
| 564 | blk:WaitForChild(f).StudsPerTileU = 2.6 | |
| 565 | blk:WaitForChild(f).StudsPerTileV = 2.6 | |
| 566 | end | |
| 567 | elseif selectedBlock == 2 then | |
| 568 | local blk = placeBlock(toolBar.Stone, CFrame.new(x, y, z)) | |
| 569 | for _,f in pairs(facesToResize) do | |
| 570 | blk:WaitForChild(f).StudsPerTileU = 2.6 | |
| 571 | blk:WaitForChild(f).StudsPerTileV = 2.6 | |
| 572 | end | |
| 573 | elseif selectedBlock == 3 then | |
| 574 | local blk = placeBlock(toolBar.Diamond_Ore, CFrame.new(x, y, z)) | |
| 575 | for _,f in pairs(facesToResize) do | |
| 576 | blk:WaitForChild(f).StudsPerTileU = 2.6 | |
| 577 | blk:WaitForChild(f).StudsPerTileV = 2.6 | |
| 578 | end | |
| 579 | elseif selectedBlock == 4 then | |
| 580 | local blk = placeBlock(toolBar.Diamond_Block, CFrame.new(x, y, z)) | |
| 581 | for _,f in pairs(facesToResize) do | |
| 582 | blk:WaitForChild(f).StudsPerTileU = 2.6 | |
| 583 | blk:WaitForChild(f).StudsPerTileV = 2.6 | |
| 584 | end | |
| 585 | elseif selectedBlock == 5 then | |
| 586 | local blk = placeBlock(toolBar.Wood_Planks, CFrame.new(x, y, z)) | |
| 587 | for _,f in pairs(facesToResize) do | |
| 588 | blk:WaitForChild(f).StudsPerTileU = 2.6 | |
| 589 | blk:WaitForChild(f).StudsPerTileV = 2.6 | |
| 590 | end | |
| 591 | elseif selectedBlock == 6 then | |
| 592 | local blk = placeBlock(toolBar.Oak_Log, CFrame.new(x, y, z)) | |
| 593 | for _,f in pairs(facesToResize) do | |
| 594 | blk:WaitForChild(f).StudsPerTileU = 2.6 | |
| 595 | blk:WaitForChild(f).StudsPerTileV = 2.6 | |
| 596 | end | |
| 597 | elseif selectedBlock == 7 or selectedBlock == 8 then | |
| 598 | if Mouse.Target.Size.X <= 10 and Mouse.Target.Size.Y <= 10 and Mouse.Target.Size.Z <= 10 then | |
| 599 | Mouse.Target.Parent = nil | |
| 600 | end | |
| 601 | end | |
| 602 | end | |
| 603 | end | |
| 604 | end) | |
| 605 | ||
| 606 | local hasItemOnHand = 0 | |
| 607 | local hi = 0 | |
| 608 | -- selection thingy | |
| 609 | local selectLabel = Instance.new("TextLabel", gui)
| |
| 610 | selectLabel.Size = UDim2.new(0, 32, 0, 32) | |
| 611 | selectLabel.Position = UDim2.new(0.5, -160 + (selectedBlock*40), 1, -105) | |
| 612 | selectLabel.BackgroundTransparency = 0.5 | |
| 613 | selectLabel.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 614 | selectLabel.BorderSizePixel = 0 | |
| 615 | selectLabel.Text = "" | |
| 616 | selectLabel.ZIndex = 3 | |
| 617 | -- | |
| 618 | Mouse.KeyDown:connect(function(key) | |
| 619 | if key == "q" then | |
| 620 | sneaking = 1 | |
| 621 | humanoid.WalkSpeed = humanoid.WalkSpeed / 2 | |
| 622 | rootJoint.C1 = CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0) | |
| 623 | lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0) | |
| 624 | rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0) | |
| 625 | --print("Sneaking...")
| |
| 626 | end | |
| 627 | if key == "8" then | |
| 628 | selectedBlock = 7 | |
| 629 | itemOnHand = nil | |
| 630 | for _,d in pairs(handItem:GetChildren()) do | |
| 631 | d:Destroy() | |
| 632 | end | |
| 633 | if hasItemOnHand == 1 then hi = 1 end | |
| 634 | end | |
| 635 | if key == "9" then | |
| 636 | selectedBlock = 8 | |
| 637 | itemOnHand = nil | |
| 638 | for _,d in pairs(handItem:GetChildren()) do | |
| 639 | d:Destroy() | |
| 640 | end | |
| 641 | if hasItemOnHand == 1 then hi = 1 end | |
| 642 | end | |
| 643 | if key == "1" then | |
| 644 | selectedBlock = 0 | |
| 645 | itemOnHand = toolBar.Dirt | |
| 646 | for _,d in pairs(handItem:GetChildren()) do | |
| 647 | d:Destroy() | |
| 648 | end | |
| 649 | putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex, | |
| 650 | itemOnHand.topTex, itemOnHand.bottomTex, | |
| 651 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
| 652 | for _,f in pairs(facesToResize) do | |
| 653 | handItem:WaitForChild(f).StudsPerTileU = 0.52 | |
| 654 | handItem:WaitForChild(f).StudsPerTileV = 0.52 | |
| 655 | end | |
| 656 | end | |
| 657 | if key == "2" then | |
| 658 | selectedBlock = 1 | |
| 659 | itemOnHand = toolBar.Grass | |
| 660 | for _,d in pairs(handItem:GetChildren()) do | |
| 661 | d:Destroy() | |
| 662 | end | |
| 663 | putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex, | |
| 664 | itemOnHand.topTex, itemOnHand.bottomTex, | |
| 665 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
| 666 | for _,f in pairs(facesToResize) do | |
| 667 | handItem:WaitForChild(f).StudsPerTileU = 0.52 | |
| 668 | handItem:WaitForChild(f).StudsPerTileV = 0.52 | |
| 669 | end | |
| 670 | end | |
| 671 | if key == "3" then | |
| 672 | selectedBlock = 2 | |
| 673 | itemOnHand = toolBar.Stone | |
| 674 | for _,d in pairs(handItem:GetChildren()) do | |
| 675 | d:Destroy() | |
| 676 | end | |
| 677 | putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex, | |
| 678 | itemOnHand.topTex, itemOnHand.bottomTex, | |
| 679 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
| 680 | for _,f in pairs(facesToResize) do | |
| 681 | handItem:WaitForChild(f).StudsPerTileU = 0.52 | |
| 682 | handItem:WaitForChild(f).StudsPerTileV = 0.52 | |
| 683 | end | |
| 684 | end | |
| 685 | if key == "4" then | |
| 686 | selectedBlock = 3 | |
| 687 | itemOnHand = toolBar.Diamond_Ore | |
| 688 | for _,d in pairs(handItem:GetChildren()) do | |
| 689 | d:Destroy() | |
| 690 | end | |
| 691 | putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex, | |
| 692 | itemOnHand.topTex, itemOnHand.bottomTex, | |
| 693 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
| 694 | for _,f in pairs(facesToResize) do | |
| 695 | handItem:WaitForChild(f).StudsPerTileU = 0.52 | |
| 696 | handItem:WaitForChild(f).StudsPerTileV = 0.52 | |
| 697 | end | |
| 698 | end | |
| 699 | if key == "5" then | |
| 700 | selectedBlock = 4 | |
| 701 | itemOnHand = toolBar.Diamond_Block | |
| 702 | for _,d in pairs(handItem:GetChildren()) do | |
| 703 | d:Destroy() | |
| 704 | end | |
| 705 | putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex, | |
| 706 | itemOnHand.topTex, itemOnHand.bottomTex, | |
| 707 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
| 708 | for _,f in pairs(facesToResize) do | |
| 709 | handItem:WaitForChild(f).StudsPerTileU = 0.52 | |
| 710 | handItem:WaitForChild(f).StudsPerTileV = 0.52 | |
| 711 | end | |
| 712 | end | |
| 713 | if key == "6" then | |
| 714 | selectedBlock = 5 | |
| 715 | itemOnHand = toolBar.Wood_Planks | |
| 716 | for _,d in pairs(handItem:GetChildren()) do | |
| 717 | d:Destroy() | |
| 718 | end | |
| 719 | putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex, | |
| 720 | itemOnHand.topTex, itemOnHand.bottomTex, | |
| 721 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
| 722 | for _,f in pairs(facesToResize) do | |
| 723 | handItem:WaitForChild(f).StudsPerTileU = 0.52 | |
| 724 | handItem:WaitForChild(f).StudsPerTileV = 0.52 | |
| 725 | end | |
| 726 | end | |
| 727 | if key == "7" then | |
| 728 | selectedBlock = 6 | |
| 729 | itemOnHand = toolBar.Oak_Log | |
| 730 | for _,d in pairs(handItem:GetChildren()) do | |
| 731 | d:Destroy() | |
| 732 | end | |
| 733 | putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex, | |
| 734 | itemOnHand.topTex, itemOnHand.bottomTex, | |
| 735 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
| 736 | for _,f in pairs(facesToResize) do | |
| 737 | handItem:WaitForChild(f).StudsPerTileU = 0.52 | |
| 738 | handItem:WaitForChild(f).StudsPerTileV = 0.52 | |
| 739 | end | |
| 740 | end | |
| 741 | if (key == "0" or key == "1" or key == "2" | |
| 742 | or key == "3" or key == "4" or key == "5" | |
| 743 | or key == "6" or key == "7") and hasItemOnHand == 0 then hi = 1 end | |
| 744 | selectLabel.Position = UDim2.new(0.5, -160 + ((selectedBlock)*40), 1, -105) | |
| 745 | end) | |
| 746 | ||
| 747 | Mouse.KeyUp:connect(function(key) | |
| 748 | if key == "q" then | |
| 749 | sneaking = 0 | |
| 750 | humanoid.WalkSpeed = humanoid.WalkSpeed * 2 | |
| 751 | rootJoint.C1 = CFrame.new(0, 0.05, 0) * CFrame.Angles(0, 0, 0) | |
| 752 | lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
| 753 | rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
| 754 | --print("Stopped sneaking...")
| |
| 755 | end | |
| 756 | end) | |
| 757 | ||
| 758 | while RS:wait() do | |
| 759 | if itemOnHand ~= nil then | |
| 760 | hasItemOnHand = 1 | |
| 761 | handItem.Transparency = 0 | |
| 762 | else | |
| 763 | hasItemOnHand = 0 | |
| 764 | handItem.Transparency = 1 | |
| 765 | end | |
| 766 | if humanoid.Health < oldHP then | |
| 767 | damageTime = 60 | |
| 768 | sound:Play() | |
| 769 | end | |
| 770 | oldHP = humanoid.Health | |
| 771 | if damageTime > 0 and humanoid.Health > 0 then | |
| 772 | for _,p in pairs(char:GetChildren()) do | |
| 773 | if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then | |
| 774 | if p.Name == "DamagePart" then | |
| 775 | p.Transparency = 0.5 | |
| 776 | end | |
| 777 | end | |
| 778 | end | |
| 779 | damageTime = damageTime - 2 | |
| 780 | if damageTime <= 0 then | |
| 781 | for _,p in pairs(char:GetChildren()) do | |
| 782 | if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then | |
| 783 | if p.Name == "DamagePart" then | |
| 784 | p.Transparency = 1 | |
| 785 | end | |
| 786 | end | |
| 787 | end | |
| 788 | end | |
| 789 | end | |
| 790 | camPart.CFrame = camera.CFrame | |
| 791 | neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), math.rad(camPart.Orientation.Y - torso.Orientation.Y), 0) | |
| 792 | neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0) | |
| 793 | ||
| 794 | if getMagnitudeXZ(torso.Velocity) > 1 then | |
| 795 | if walkAnim >= 1 then | |
| 796 | increaseWalkAnim = -1 | |
| 797 | elseif walkAnim <= -1 then | |
| 798 | increaseWalkAnim = 1 | |
| 799 | end | |
| 800 | walkAnim = walkAnim + (increaseWalkAnim/(10+(sneaking*20))) | |
| 801 | else | |
| 802 | walkAnim = 0 | |
| 803 | end | |
| 804 | ||
| 805 | --lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0) | |
| 806 | --rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0) | |
| 807 | lH.C0 = lH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)), 0, 0), 0.1) | |
| 808 | rH.C0 = rH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)), 0, 0), 0.1) | |
| 809 | -- | |
| 810 | --rootJoint.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0) | |
| 811 | --print(math.abs(head.Orientation.Y) - math.abs(humRootPart.Orientation.Y)) | |
| 812 | --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) > 45 then | |
| 813 | --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(-45 + head.Orientation.Y), 0) | |
| 814 | --print("-45")
| |
| 815 | --end | |
| 816 | --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) < -45 then | |
| 817 | --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(45 + head.Orientation.Y), 0) | |
| 818 | --print("45")
| |
| 819 | --end | |
| 820 | ||
| 821 | --move these arms | |
| 822 | rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), math.rad(punchRotY), 0), 0.2) | |
| 823 | ||
| 824 | lS.C0 = lS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(idleAnimRotX/20 + math.rad(-hasItemOnHand*10) + 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) + divide(punchSpeed, 6) + hi) | |
| 825 | rS.C0 = rS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(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)) | |
| 826 | if punching == 1 and punchEnded == 1 then | |
| 827 | punching = 0 | |
| 828 | --print("steve uses punch!!")
| |
| 829 | local coPunch = coroutine.wrap(function() | |
| 830 | punchEnded = 0 | |
| 831 | punchSpeed = 1 | |
| 832 | punchRotX = -60 | |
| 833 | punchRotY = -8 | |
| 834 | punchRotZ = -35 | |
| 835 | wait(0.075) | |
| 836 | punchSpeed = 1 | |
| 837 | punchRotX = -75 | |
| 838 | punchRotY = 8 | |
| 839 | punchRotZ = 40 | |
| 840 | wait(0.075) | |
| 841 | punchSpeed = 1 | |
| 842 | punchRotX = -20 | |
| 843 | punchRotZ = 40 | |
| 844 | wait(0.075) | |
| 845 | punchSpeed = 3.5 | |
| 846 | punchRotX = 0 | |
| 847 | punchRotY = 0 | |
| 848 | punchRotZ = 0 | |
| 849 | punchEnded = 1 | |
| 850 | wait(0.06) | |
| 851 | punchSpeed = 0 | |
| 852 | end) | |
| 853 | coPunch() | |
| 854 | end | |
| 855 | if ticks > 20 then | |
| 856 | ticks = 0 | |
| 857 | if times == 0 then | |
| 858 | times = times + 1 | |
| 859 | idleAnimRotX = -1 | |
| 860 | idleAnimRotZ = 0 | |
| 861 | elseif times == 1 then | |
| 862 | times = times + 1 | |
| 863 | idleAnimRotX = -0.75 | |
| 864 | idleAnimRotZ = -0.75 | |
| 865 | elseif times == 2 then | |
| 866 | times = times + 1 | |
| 867 | idleAnimRotX = 0 | |
| 868 | idleAnimRotZ = -1 | |
| 869 | elseif times == 3 then | |
| 870 | times = times + 1 | |
| 871 | idleAnimRotX = 0.75 | |
| 872 | idleAnimRotZ = -0.75 | |
| 873 | --idleAnimRotX = 0.75 | |
| 874 | --idleAnimRotZ = -0 | |
| 875 | elseif times == 4 then | |
| 876 | times = times + 1 | |
| 877 | idleAnimRotX = 1 | |
| 878 | idleAnimRotZ = 0 | |
| 879 | --idleAnimRotX = 1 | |
| 880 | --idleAnimRotZ = 0 | |
| 881 | elseif times == 5 then | |
| 882 | times = times + 1 | |
| 883 | idleAnimRotX = 0.75 | |
| 884 | idleAnimRotZ = 0.75 | |
| 885 | elseif times == 6 then | |
| 886 | times = times + 1 | |
| 887 | idleAnimRotX = 0 | |
| 888 | idleAnimRotZ = 1 | |
| 889 | elseif times == 7 then | |
| 890 | times = 0 | |
| 891 | idleAnimRotX = -0.75 | |
| 892 | idleAnimRotZ = 0.75 | |
| 893 | end | |
| 894 | end | |
| 895 | if hi == 1 then hi = 0 end | |
| 896 | ticks = ticks + 1 | |
| 897 | end | |
| 898 | end | |
| 899 | end |