SHOW:
|
|
- or go back to the newest paste.
| 1 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 2 | local Player,game,owner = owner,game | |
| 3 | local RealPlayer = Player | |
| 4 | do | |
| 5 | print("FE Compatibility code V2 by Mokiros")
| |
| 6 | local RealPlayer = RealPlayer | |
| 7 | script.Parent = RealPlayer.Character | |
| 8 | ||
| 9 | --Fake event to make stuff like Mouse.KeyDown work | |
| 10 | local Disconnect_Function = function(this) | |
| 11 | this[1].Functions[this[2]] = nil | |
| 12 | end | |
| 13 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
| |
| 14 | local FakeEvent_Metatable = {__index={
| |
| 15 | Connect = function(this,f) | |
| 16 | local i = tostring(math.random(0,10000)) | |
| 17 | while this.Functions[i] do | |
| 18 | i = tostring(math.random(0,10000)) | |
| 19 | end | |
| 20 | this.Functions[i] = f | |
| 21 | return setmetatable({this,i},Disconnect_Metatable)
| |
| 22 | end | |
| 23 | }} | |
| 24 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
| 25 | local function fakeEvent() | |
| 26 | return setmetatable({Functions={}},FakeEvent_Metatable)
| |
| 27 | end | |
| 28 | ||
| 29 | --Creating fake input objects with fake variables | |
| 30 | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
| |
| 31 | FakeMouse.keyUp = FakeMouse.KeyUp | |
| 32 | FakeMouse.keyDown = FakeMouse.KeyDown | |
| 33 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 34 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 35 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 36 | end} | |
| 37 | --Merged 2 functions into one by checking amount of arguments | |
| 38 | CAS.UnbindAction = CAS.BindAction | |
| 39 | ||
| 40 | --This function will trigger the events that have been :Connect()'ed | |
| 41 | local function TriggerEvent(self,ev,...) | |
| 42 | for _,f in pairs(self[ev].Functions) do | |
| 43 | f(...) | |
| 44 | end | |
| 45 | end | |
| 46 | FakeMouse.TriggerEvent = TriggerEvent | |
| 47 | UIS.TriggerEvent = TriggerEvent | |
| 48 | ||
| 49 | --Client communication | |
| 50 | local Event = Instance.new("RemoteEvent")
| |
| 51 | Event.Name = "UserInput_Event" | |
| 52 | Event.OnServerEvent:Connect(function(plr,io) | |
| 53 | if plr~=RealPlayer then return end | |
| 54 | FakeMouse.Target = io.Target | |
| 55 | FakeMouse.Hit = io.Hit | |
| 56 | if not io.isMouse then | |
| 57 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 58 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 59 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
| 60 | end | |
| 61 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
| 62 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
| 63 | end | |
| 64 | for _,t in pairs(CAS.Actions) do | |
| 65 | for _,k in pairs(t.Keys) do | |
| 66 | if k==io.KeyCode then | |
| 67 | t.Function(t.Name,io.UserInputState,io) | |
| 68 | end | |
| 69 | end | |
| 70 | end | |
| 71 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 72 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 73 | end | |
| 74 | end) | |
| 75 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
| |
| 76 | local Mouse = owner:GetMouse() | |
| 77 | local UIS = game:GetService("UserInputService")
| |
| 78 | local input = function(io,RobloxHandled) | |
| 79 | if RobloxHandled then return end | |
| 80 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 81 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 82 | end | |
| 83 | UIS.InputBegan:Connect(input) | |
| 84 | UIS.InputEnded:Connect(input) | |
| 85 | local h,t | |
| 86 | --Give the server mouse data every second frame, but only if the values changed | |
| 87 | --If player is not moving their mouse, client won't fire events | |
| 88 | local HB = game:GetService("RunService").Heartbeat
| |
| 89 | while true do | |
| 90 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 91 | h,t=Mouse.Hit,Mouse.Target | |
| 92 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 93 | end | |
| 94 | --Wait 2 frames | |
| 95 | for i=1,2 do | |
| 96 | HB:Wait() | |
| 97 | end | |
| 98 | end]==],script) | |
| 99 | ||
| 100 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 101 | --Real game object | |
| 102 | local RealGame = game | |
| 103 | ||
| 104 | --Metatable for fake service | |
| 105 | local FakeService_Metatable = {
| |
| 106 | __index = function(self,k) | |
| 107 | local s = rawget(self,"_RealService") | |
| 108 | if s then | |
| 109 | return typeof(s[k])=="function" | |
| 110 | and function(_,...)return s[k](s,...)end or s[k] | |
| 111 | end | |
| 112 | end, | |
| 113 | __newindex = function(self,k,v) | |
| 114 | local s = rawget(self,"_RealService") | |
| 115 | if s then s[k]=v end | |
| 116 | end | |
| 117 | } | |
| 118 | local function FakeService(t,RealService) | |
| 119 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
| 120 | return setmetatable(t,FakeService_Metatable) | |
| 121 | end | |
| 122 | ||
| 123 | --Fake game object | |
| 124 | local FakeGame = {
| |
| 125 | GetService = function(self,s) | |
| 126 | return rawget(self,s) or RealGame:GetService(s) | |
| 127 | end, | |
| 128 | Players = FakeService({
| |
| 129 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
| |
| 130 | },"Players"), | |
| 131 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 132 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 133 | RunService = FakeService({
| |
| 134 | _btrs = {},
| |
| 135 | RenderStepped = RealGame:GetService("RunService").Heartbeat,
| |
| 136 | BindToRenderStep = function(self,name,_,fun) | |
| 137 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 138 | end, | |
| 139 | UnbindFromRenderStep = function(self,name) | |
| 140 | self._btrs[name]:Disconnect() | |
| 141 | end, | |
| 142 | },"RunService") | |
| 143 | } | |
| 144 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
| 145 | FakeGame.service = FakeGame.GetService | |
| 146 | FakeService(FakeGame,game) | |
| 147 | --Changing owner to fake player object to support owner:GetMouse() | |
| 148 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
| 149 | end | |
| 150 | Player=game:GetService("Players").LocalPlayer
| |
| 151 | Character=Player.Character | |
| 152 | PlayerGui=Player.PlayerGui | |
| 153 | Backpack=Player.Backpack | |
| 154 | Torso=Character.Torso | |
| 155 | Head=Character.Head | |
| 156 | Humanoid=Character.Humanoid | |
| 157 | LeftArm=Character["Left Arm"] | |
| 158 | LeftLeg=Character["Left Leg"] | |
| 159 | RightArm=Character["Right Arm"] | |
| 160 | RightLeg=Character["Right Leg"] | |
| 161 | LS=Torso["Left Shoulder"] | |
| 162 | LH=Torso["Left Hip"] | |
| 163 | RS=Torso["Right Shoulder"] | |
| 164 | RH=Torso["Right Hip"] | |
| 165 | Face = Head.face | |
| 166 | Neck=Torso.Neck | |
| 167 | it=Instance.new | |
| 168 | attacktype=1 | |
| 169 | vt=Vector3.new | |
| 170 | cf=CFrame.new | |
| 171 | euler=CFrame.fromEulerAnglesXYZ | |
| 172 | angles=CFrame.Angles | |
| 173 | cloaked=false | |
| 174 | necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
| 175 | necko2=cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
| 176 | LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0) | |
| 177 | LHC1=cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0) | |
| 178 | RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0) | |
| 179 | RHC1=cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0) | |
| 180 | RootPart=Character.HumanoidRootPart | |
| 181 | RootJoint=RootPart.RootJoint | |
| 182 | RootCF=euler(-1.57,0,3.14) | |
| 183 | attack = false | |
| 184 | attackdebounce = false | |
| 185 | deb=false | |
| 186 | equipped=true | |
| 187 | hand=false | |
| 188 | MMouse=nil | |
| 189 | combo=0 | |
| 190 | mana=0 | |
| 191 | trispeed=.2 | |
| 192 | attackmode='none' | |
| 193 | local idle=0 | |
| 194 | local Anim="Idle" | |
| 195 | local Effects={}
| |
| 196 | local gun=false | |
| 197 | local shoot=false | |
| 198 | player=nil | |
| 199 | mana=0 | |
| 200 | cam = workspace.CurrentCamera | |
| 201 | ZTarget = nil | |
| 202 | RocketTarget = nil | |
| 203 | local m = Instance.new("Model",Character)
| |
| 204 | m.Name = "WeaponModel" | |
| 205 | ||
| 206 | mouse=Player:GetMouse() | |
| 207 | --save shoulders | |
| 208 | RSH, LSH=nil, nil | |
| 209 | --welds | |
| 210 | RW, LW=Instance.new("Weld"), Instance.new("Weld")
| |
| 211 | RW.Name="Right Shoulder" LW.Name="Left Shoulder" | |
| 212 | LH=Torso["Left Hip"] | |
| 213 | RH=Torso["Right Hip"] | |
| 214 | TorsoColor=Torso.BrickColor | |
| 215 | function NoOutline(Part) | |
| 216 | Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10 | |
| 217 | end | |
| 218 | player=Player | |
| 219 | ch=Character | |
| 220 | RSH=ch.Torso["Right Shoulder"] | |
| 221 | LSH=ch.Torso["Left Shoulder"] | |
| 222 | -- | |
| 223 | RSH.Parent=nil | |
| 224 | LSH.Parent=nil | |
| 225 | -- | |
| 226 | RW.Name="Right Shoulder" | |
| 227 | RW.Part0=ch.Torso | |
| 228 | RW.C0=cf(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5) | |
| 229 | RW.C1=cf(0, 0.5, 0) | |
| 230 | RW.Part1=ch["Right Arm"] | |
| 231 | RW.Parent=ch.Torso | |
| 232 | -- | |
| 233 | LW.Name="Left Shoulder" | |
| 234 | LW.Part0=ch.Torso | |
| 235 | LW.C0=cf(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8) | |
| 236 | LW.C1=cf(0, 0.5, 0) | |
| 237 | LW.Part1=ch["Left Arm"] | |
| 238 | LW.Parent=ch.Torso | |
| 239 | ||
| 240 | function swait(num) | |
| 241 | if num==0 or num==nil then | |
| 242 | game:service'RunService'.Heartbeat:wait(0) | |
| 243 | else | |
| 244 | for i=0,num do | |
| 245 | game:service'RunService'.Heartbeat:wait(0) | |
| 246 | end | |
| 247 | end | |
| 248 | end | |
| 249 | ||
| 250 | function nooutline(part) | |
| 251 | part.TopSurface,part.BottomSurface,part.LeftSurface,part.RightSurface,part.FrontSurface,part.BackSurface = 10,10,10,10,10,10 | |
| 252 | end | |
| 253 | ||
| 254 | function part(formfactor,parent,material,reflectance,transparency,brickcolor,name,size) | |
| 255 | local fp=it("Part")
| |
| 256 | fp.formFactor=formfactor | |
| 257 | fp.Parent=parent | |
| 258 | fp.Reflectance=reflectance | |
| 259 | fp.Transparency=transparency | |
| 260 | fp.CanCollide=false | |
| 261 | fp.Locked=true | |
| 262 | fp.BrickColor=BrickColor.new(tostring(brickcolor)) | |
| 263 | fp.Name=name | |
| 264 | fp.Size=size | |
| 265 | fp.Position=Character.Torso.Position | |
| 266 | nooutline(fp) | |
| 267 | fp.Material=material | |
| 268 | fp:BreakJoints() | |
| 269 | return fp | |
| 270 | end | |
| 271 | ||
| 272 | function mesh(Mesh,part,meshtype,meshid,offset,scale) | |
| 273 | local mesh=it(Mesh) | |
| 274 | mesh.Parent=part | |
| 275 | if Mesh=="SpecialMesh" then | |
| 276 | mesh.MeshType=meshtype | |
| 277 | mesh.MeshId=meshid | |
| 278 | end | |
| 279 | mesh.Offset=offset | |
| 280 | mesh.Scale=scale | |
| 281 | return mesh | |
| 282 | end | |
| 283 | ||
| 284 | function weld(parent,part0,part1,c0,c1) | |
| 285 | local weld=it("Weld")
| |
| 286 | weld.Parent=parent | |
| 287 | weld.Part0=part0 | |
| 288 | weld.Part1=part1 | |
| 289 | weld.C0=c0 | |
| 290 | weld.C1=c1 | |
| 291 | return weld | |
| 292 | end | |
| 293 | ||
| 294 | ||
| 295 | local function CFrameFromTopBack(at, top, back) | |
| 296 | local right = top:Cross(back) | |
| 297 | return CFrame.new(at.x, at.y, at.z, | |
| 298 | right.x, top.x, back.x, | |
| 299 | right.y, top.y, back.y, | |
| 300 | right.z, top.z, back.z) | |
| 301 | end | |
| 302 | ||
| 303 | function Triangle(a, b, c) | |
| 304 | local edg1 = (c-a):Dot((b-a).unit) | |
| 305 | local edg2 = (a-b):Dot((c-b).unit) | |
| 306 | local edg3 = (b-c):Dot((a-c).unit) | |
| 307 | if edg1 <= (b-a).magnitude and edg1 >= 0 then | |
| 308 | a, b, c = a, b, c | |
| 309 | elseif edg2 <= (c-b).magnitude and edg2 >= 0 then | |
| 310 | a, b, c = b, c, a | |
| 311 | elseif edg3 <= (a-c).magnitude and edg3 >= 0 then | |
| 312 | a, b, c = c, a, b | |
| 313 | else | |
| 314 | assert(false, "unreachable") | |
| 315 | end | |
| 316 | ||
| 317 | local len1 = (c-a):Dot((b-a).unit) | |
| 318 | local len2 = (b-a).magnitude - len1 | |
| 319 | local width = (a + (b-a).unit*len1 - c).magnitude | |
| 320 | ||
| 321 | local maincf = CFrameFromTopBack(a, (b-a):Cross(c-b).unit, -(b-a).unit) | |
| 322 | ||
| 323 | local list = {}
| |
| 324 | ||
| 325 | local TrailColor = ("Dark grey")
| |
| 326 | ||
| 327 | if len1 > 0.01 then | |
| 328 | local w1 = Instance.new('WedgePart', m)
| |
| 329 | game:GetService("Debris"):AddItem(w1,5)
| |
| 330 | w1.Material = "SmoothPlastic" | |
| 331 | w1.FormFactor = 'Custom' | |
| 332 | w1.BrickColor = BrickColor.new(TrailColor) | |
| 333 | w1.Transparency = 0 | |
| 334 | w1.Reflectance = 0 | |
| 335 | w1.Material = "SmoothPlastic" | |
| 336 | w1.CanCollide = false | |
| 337 | NoOutline(w1) | |
| 338 | local sz = Vector3.new(0.2, width, len1) | |
| 339 | w1.Size = sz | |
| 340 | local sp = Instance.new("SpecialMesh",w1)
| |
| 341 | sp.MeshType = "Wedge" | |
| 342 | sp.Scale = Vector3.new(0,1,1) * sz/w1.Size | |
| 343 | w1:BreakJoints() | |
| 344 | w1.Anchored = true | |
| 345 | w1.Parent = workspace | |
| 346 | w1.Transparency = 0.7 | |
| 347 | table.insert(Effects,{w1,"Disappear",.01})
| |
| 348 | w1.CFrame = maincf*CFrame.Angles(math.pi,0,math.pi/2)*CFrame.new(0,width/2,len1/2) | |
| 349 | table.insert(list,w1) | |
| 350 | end | |
| 351 | ||
| 352 | if len2 > 0.01 then | |
| 353 | local w2 = Instance.new('WedgePart', m)
| |
| 354 | game:GetService("Debris"):AddItem(w2,5)
| |
| 355 | w2.Material = "SmoothPlastic" | |
| 356 | w2.FormFactor = 'Custom' | |
| 357 | w2.BrickColor = BrickColor.new(TrailColor) | |
| 358 | w2.Transparency = 0 | |
| 359 | w2.Reflectance = 0 | |
| 360 | w2.Material = "SmoothPlastic" | |
| 361 | w2.CanCollide = false | |
| 362 | NoOutline(w2) | |
| 363 | local sz = Vector3.new(0.2, width, len2) | |
| 364 | w2.Size = sz | |
| 365 | local sp = Instance.new("SpecialMesh",w2)
| |
| 366 | sp.MeshType = "Wedge" | |
| 367 | sp.Scale = Vector3.new(0,1,1) * sz/w2.Size | |
| 368 | w2:BreakJoints() | |
| 369 | w2.Anchored = true | |
| 370 | w2.Parent = workspace | |
| 371 | w2.Transparency = 0.7 | |
| 372 | table.insert(Effects,{w2,"Disappear",.01})
| |
| 373 | w2.CFrame = maincf*CFrame.Angles(math.pi,math.pi,-math.pi/2)*CFrame.new(0,width/2,-len1 - len2/2) | |
| 374 | table.insert(list,w2) | |
| 375 | end | |
| 376 | return unpack(list) | |
| 377 | end | |
| 378 | ||
| 379 | ||
| 380 | so = function(id,par,vol,pit) | |
| 381 | coroutine.resume(coroutine.create(function() | |
| 382 | local sou = Instance.new("Sound",par or workspace)
| |
| 383 | sou.Volume=vol | |
| 384 | sou.Pitch=pit or 1 | |
| 385 | sou.SoundId=id | |
| 386 | swait() | |
| 387 | sou:play() | |
| 388 | game:GetService("Debris"):AddItem(sou,6)
| |
| 389 | end)) | |
| 390 | end | |
| 391 | ||
| 392 | function clerp(a,b,t) | |
| 393 | local qa = {QuaternionFromCFrame(a)}
| |
| 394 | local qb = {QuaternionFromCFrame(b)}
| |
| 395 | local ax, ay, az = a.x, a.y, a.z | |
| 396 | local bx, by, bz = b.x, b.y, b.z | |
| 397 | local _t = 1-t | |
| 398 | return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t)) | |
| 399 | end | |
| 400 | ||
| 401 | function QuaternionFromCFrame(cf) | |
| 402 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() | |
| 403 | local trace = m00 + m11 + m22 | |
| 404 | if trace > 0 then | |
| 405 | local s = math.sqrt(1 + trace) | |
| 406 | local recip = 0.5/s | |
| 407 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 | |
| 408 | else | |
| 409 | local i = 0 | |
| 410 | if m11 > m00 then | |
| 411 | i = 1 | |
| 412 | end | |
| 413 | if m22 > (i == 0 and m00 or m11) then | |
| 414 | i = 2 | |
| 415 | end | |
| 416 | if i == 0 then | |
| 417 | local s = math.sqrt(m00-m11-m22+1) | |
| 418 | local recip = 0.5/s | |
| 419 | return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip | |
| 420 | elseif i == 1 then | |
| 421 | local s = math.sqrt(m11-m22-m00+1) | |
| 422 | local recip = 0.5/s | |
| 423 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip | |
| 424 | elseif i == 2 then | |
| 425 | local s = math.sqrt(m22-m00-m11+1) | |
| 426 | local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip | |
| 427 | end | |
| 428 | end | |
| 429 | end | |
| 430 | ||
| 431 | function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
| 432 | local xs, ys, zs = x + x, y + y, z + z | |
| 433 | local wx, wy, wz = w*xs, w*ys, w*zs | |
| 434 | local xx = x*xs | |
| 435 | local xy = x*ys | |
| 436 | local xz = x*zs | |
| 437 | local yy = y*ys | |
| 438 | local yz = y*zs | |
| 439 | local zz = z*zs | |
| 440 | return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) | |
| 441 | end | |
| 442 | ||
| 443 | function QuaternionSlerp(a, b, t) | |
| 444 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] | |
| 445 | local startInterp, finishInterp; | |
| 446 | if cosTheta >= 0.0001 then | |
| 447 | if (1 - cosTheta) > 0.0001 then | |
| 448 | local theta = math.acos(cosTheta) | |
| 449 | local invSinTheta = 1/math.sin(theta) | |
| 450 | startInterp = math.sin((1-t)*theta)*invSinTheta | |
| 451 | finishInterp = math.sin(t*theta)*invSinTheta | |
| 452 | else | |
| 453 | startInterp = 1-t | |
| 454 | finishInterp = t | |
| 455 | end | |
| 456 | else | |
| 457 | if (1+cosTheta) > 0.0001 then | |
| 458 | local theta = math.acos(-cosTheta) | |
| 459 | local invSinTheta = 1/math.sin(theta) | |
| 460 | startInterp = math.sin((t-1)*theta)*invSinTheta | |
| 461 | finishInterp = math.sin(t*theta)*invSinTheta | |
| 462 | else | |
| 463 | startInterp = t-1 | |
| 464 | finishInterp = t | |
| 465 | end | |
| 466 | end | |
| 467 | return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp | |
| 468 | end | |
| 469 | ||
| 470 | function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants | |
| 471 | return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
| |
| 472 | end | |
| 473 | ||
| 474 | Damagefunc=function(Part,hit,minim,maxim,knockback,Type,Property,Delay,KnockbackType,decreaseblock) | |
| 475 | if hit.Parent==nil then | |
| 476 | return | |
| 477 | end | |
| 478 | local h=hit.Parent:FindFirstChild("Humanoid")
| |
| 479 | for _,v in pairs(hit.Parent:children()) do | |
| 480 | if v:IsA("Humanoid") then
| |
| 481 | h=v | |
| 482 | end | |
| 483 | end | |
| 484 | if hit.Parent.Parent:FindFirstChild("Torso")~=nil then
| |
| 485 | h=hit.Parent.Parent:FindFirstChild("Humanoid")
| |
| 486 | end | |
| 487 | if hit.Parent.className=="Hat" then | |
| 488 | hit=hit.Parent.Parent:findFirstChild("Head")
| |
| 489 | end | |
| 490 | if h~=nil and hit.Parent.Name~=Character.Name and hit.Parent:FindFirstChild("Torso")~=nil then
| |
| 491 | if hit.Parent:findFirstChild("DebounceHit")~=nil then if hit.Parent.DebounceHit.Value==true then return end end
| |
| 492 | --[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then | |
| 493 | return | |
| 494 | end]] | |
| 495 | -- hs(hit,1.2) | |
| 496 | local c=Instance.new("ObjectValue")
| |
| 497 | c.Name="creator" | |
| 498 | c.Value=game:service("Players").LocalPlayer
| |
| 499 | c.Parent=h | |
| 500 | game:GetService("Debris"):AddItem(c,.5)
| |
| 501 | local Damage=math.random(minim,maxim) | |
| 502 | -- h:TakeDamage(Damage) | |
| 503 | local blocked=false | |
| 504 | local block=hit.Parent:findFirstChild("Block")
| |
| 505 | if block~=nil then | |
| 506 | print(block.className) | |
| 507 | if block.className=="NumberValue" then | |
| 508 | if block.Value>0 then | |
| 509 | blocked=true | |
| 510 | if decreaseblock==nil then | |
| 511 | block.Value=block.Value-1 | |
| 512 | end | |
| 513 | end | |
| 514 | end | |
| 515 | if block.className=="IntValue" then | |
| 516 | if block.Value>0 then | |
| 517 | blocked=true | |
| 518 | if decreaseblock~=nil then | |
| 519 | block.Value=block.Value-1 | |
| 520 | end | |
| 521 | end | |
| 522 | end | |
| 523 | end | |
| 524 | if blocked==false then | |
| 525 | -- h:TakeDamage(Damage) | |
| 526 | h.Health=h.Health-Damage | |
| 527 | ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, Part.BrickColor.Color) | |
| 528 | else | |
| 529 | h.Health=h.Health-(Damage/2) | |
| 530 | ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, BrickColor.new("Bright blue").Color)
| |
| 531 | end | |
| 532 | if Type=="Knockdown" then | |
| 533 | local hum=hit.Parent.Humanoid | |
| 534 | hum.PlatformStand=true | |
| 535 | coroutine.resume(coroutine.create(function(HHumanoid) | |
| 536 | swait(1) | |
| 537 | HHumanoid.PlatformStand=false | |
| 538 | end),hum) | |
| 539 | local angle=(hit.Position-(Property.Position+Vector3.new(0,0,0))).unit | |
| 540 | --hit.CFrame=CFrame.new(hit.Position,Vector3.new(angle.x,hit.Position.y,angle.z))*CFrame.fromEulerAnglesXYZ(math.pi/4,0,0) | |
| 541 | local bodvol=Instance.new("BodyVelocity")
| |
| 542 | bodvol.velocity=angle*knockback | |
| 543 | bodvol.P=5000 | |
| 544 | bodvol.maxForce=Vector3.new(8e+003, 8e+003, 8e+003) | |
| 545 | bodvol.Parent=hit | |
| 546 | local rl=Instance.new("BodyAngularVelocity")
| |
| 547 | rl.P=3000 | |
| 548 | rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000 | |
| 549 | rl.angularvelocity=Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10)) | |
| 550 | rl.Parent=hit | |
| 551 | game:GetService("Debris"):AddItem(bodvol,.5)
| |
| 552 | game:GetService("Debris"):AddItem(rl,.5)
| |
| 553 | elseif Type=="Normal" then | |
| 554 | local vp=Instance.new("BodyVelocity")
| |
| 555 | vp.P=500 | |
| 556 | vp.maxForce=Vector3.new(math.huge,0,math.huge) | |
| 557 | -- vp.velocity=Character.Torso.CFrame.lookVector*Knockback | |
| 558 | if KnockbackType==1 then | |
| 559 | vp.velocity=Property.CFrame.lookVector*knockback+Property.Velocity/1.05 | |
| 560 | elseif KnockbackType==2 then | |
| 561 | vp.velocity=Property.CFrame.lookVector*knockback | |
| 562 | end | |
| 563 | if knockback>0 then | |
| 564 | vp.Parent=hit.Parent.Torso | |
| 565 | end | |
| 566 | game:GetService("Debris"):AddItem(vp,.5)
| |
| 567 | elseif Type=="Up" then | |
| 568 | local bodyVelocity=Instance.new("BodyVelocity")
| |
| 569 | bodyVelocity.velocity=vt(0,60,0) | |
| 570 | bodyVelocity.P=5000 | |
| 571 | bodyVelocity.maxForce=Vector3.new(8e+003, 8e+003, 8e+003) | |
| 572 | bodyVelocity.Parent=hit | |
| 573 | game:GetService("Debris"):AddItem(bodyVelocity,1)
| |
| 574 | local rl=Instance.new("BodyAngularVelocity")
| |
| 575 | rl.P=3000 | |
| 576 | rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000 | |
| 577 | rl.angularvelocity=Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30)) | |
| 578 | rl.Parent=hit | |
| 579 | game:GetService("Debris"):AddItem(rl,.5)
| |
| 580 | elseif Type=="Snare" then | |
| 581 | local bp=Instance.new("BodyPosition")
| |
| 582 | bp.P=2000 | |
| 583 | bp.D=100 | |
| 584 | bp.maxForce=Vector3.new(math.huge,math.huge,math.huge) | |
| 585 | bp.position=hit.Parent.Torso.Position | |
| 586 | bp.Parent=hit.Parent.Torso | |
| 587 | game:GetService("Debris"):AddItem(bp,1)
| |
| 588 | elseif Type=="Target" then | |
| 589 | local Targetting = false | |
| 590 | if Targetting==false then | |
| 591 | ZTarget=hit.Parent.Torso | |
| 592 | coroutine.resume(coroutine.create(function(Part) | |
| 593 | so("http://www.roblox.com/asset/?id=15666462",Part,1,1.5)
| |
| 594 | swait(5) | |
| 595 | so("http://www.roblox.com/asset/?id=15666462",Part,1,1.5)
| |
| 596 | end),ZTarget) | |
| 597 | local TargHum=ZTarget.Parent:findFirstChild("Humanoid")
| |
| 598 | local targetgui=Instance.new("BillboardGui")
| |
| 599 | targetgui.Parent=ZTarget | |
| 600 | targetgui.Size=UDim2.new(10,100,10,100) | |
| 601 | local targ=Instance.new("ImageLabel")
| |
| 602 | targ.Parent=targetgui | |
| 603 | targ.BackgroundTransparency=1 | |
| 604 | targ.Image="rbxassetid://4834067" | |
| 605 | targ.Size=UDim2.new(1,0,1,0) | |
| 606 | cam.CameraType="Scriptable" | |
| 607 | cam.CoordinateFrame=CFrame.new(Head.CFrame.p,ZTarget.Position) | |
| 608 | local dir=Vector3.new(cam.CoordinateFrame.lookVector.x,0,cam.CoordinateFrame.lookVector.z) | |
| 609 | workspace.CurrentCamera.CoordinateFrame=CFrame.new(Head.CFrame.p,ZTarget.Position) | |
| 610 | Targetting=true | |
| 611 | RocketTarget=ZTarget | |
| 612 | for i=1,Property do | |
| 613 | --while Targetting==true and Humanoid.Health>0 and Character.Parent~=nil do | |
| 614 | if Humanoid.Health>0 and Character.Parent~=nil and TargHum.Health>0 and TargHum.Parent~=nil and Targetting==true then | |
| 615 | swait() | |
| 616 | end | |
| 617 | --workspace.CurrentCamera.CoordinateFrame=CFrame.new(Head.CFrame.p,Head.CFrame.p+rmdir*100) | |
| 618 | cam.CoordinateFrame=CFrame.new(Head.CFrame.p,ZTarget.Position) | |
| 619 | dir=Vector3.new(cam.CoordinateFrame.lookVector.x,0,cam.CoordinateFrame.lookVector.z) | |
| 620 | cam.CoordinateFrame=CFrame.new(Head.CFrame.p,ZTarget.Position)*cf(0,5,10)*euler(-0.3,0,0) | |
| 621 | end | |
| 622 | Targetting=false | |
| 623 | RocketTarget=nil | |
| 624 | targetgui.Parent=nil | |
| 625 | cam.CameraType="Custom" | |
| 626 | end | |
| 627 | end | |
| 628 | local debounce=Instance.new("BoolValue")
| |
| 629 | debounce.Name="DebounceHit" | |
| 630 | debounce.Parent=hit.Parent | |
| 631 | debounce.Value=true | |
| 632 | game:GetService("Debris"):AddItem(debounce,Delay)
| |
| 633 | c=Instance.new("ObjectValue")
| |
| 634 | c.Name="creator" | |
| 635 | c.Value=Player | |
| 636 | c.Parent=h | |
| 637 | game:GetService("Debris"):AddItem(c,.5)
| |
| 638 | end | |
| 639 | end | |
| 640 | ||
| 641 | ||
| 642 | function ShowDamage(Pos, Text, Time, Color) | |
| 643 | local Rate = (1 / 30) | |
| 644 | local Pos = (Pos or Vector3.new(0, 0, 0)) | |
| 645 | local Text = (Text or "") | |
| 646 | local Time = (Time or 2) | |
| 647 | local Color = (Color or Color3.new(1, 0, 0)) | |
| 648 | local EffectPart = part("Custom",workspace,"SmoothPlastic",0,1,BrickColor.new(Color),"Effect",vt(0,0,0))
| |
| 649 | EffectPart.Anchored = true | |
| 650 | local BillboardGui = Instance.new("BillboardGui")
| |
| 651 | BillboardGui.Size = UDim2.new(3, 0, 3, 0) | |
| 652 | BillboardGui.Adornee = EffectPart | |
| 653 | local TextLabel = Instance.new("TextLabel")
| |
| 654 | TextLabel.BackgroundTransparency = 1 | |
| 655 | TextLabel.Size = UDim2.new(1, 0, 1, 0) | |
| 656 | TextLabel.Text = Text | |
| 657 | TextLabel.TextColor3 = Color | |
| 658 | TextLabel.TextScaled = true | |
| 659 | TextLabel.Font = Enum.Font.ArialBold | |
| 660 | TextLabel.Parent = BillboardGui | |
| 661 | BillboardGui.Parent = EffectPart | |
| 662 | game.Debris:AddItem(EffectPart, (Time + 0.1)) | |
| 663 | EffectPart.Parent = game:GetService("Workspace")
| |
| 664 | Delay(0, function() | |
| 665 | local Frames = (Time / Rate) | |
| 666 | for Frame = 1, Frames do | |
| 667 | wait(Rate) | |
| 668 | local Percent = (Frame / Frames) | |
| 669 | EffectPart.CFrame = CFrame.new(Pos) + Vector3.new(0, Percent, 0) | |
| 670 | TextLabel.TextTransparency = Percent | |
| 671 | end | |
| 672 | if EffectPart and EffectPart.Parent then | |
| 673 | EffectPart:Destroy() | |
| 674 | end | |
| 675 | end) | |
| 676 | end | |
| 677 | ||
| 678 | --example: local con = HitboxB.Touched:connect(function(hit) Damagefunc(Hitbox,hit,Dmg,Dmg,math.random(Knockback,Knockback),"Normal",RootPart,.2,1) end) | |
| 679 | ||
| 680 | handle=part(Enum.FormFactor.Custom,m,Enum.Material.SmoothPlastic,0,0,"Cool yellow","Handle",Vector3.new(0.34799999, 1.85999942, 0.34799999)) | |
| 681 | handleweld=weld(m,Character["Right Arm"],handle,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(-0.0957183838, 0.289899826, 1.02796435, 0.999997258, -4.47034765e-008, -4.76837329e-007, 4.76837158e-007, -4.47016042e-008, -1.00000381, 5.96046448e-008, 0.999994218, -4.47017996e-008)) | |
| 682 | mesh("CylinderMesh",handle,"","",Vector3.new(0, 0, 0),Vector3.new(1, 1, 1))
| |
| 683 | Part=part(Enum.FormFactor.Custom,m,Enum.Material.SmoothPlastic,0,0,"Institutional white","Part",Vector3.new(3.6771996, 0.348000109, 0.620599985)) | |
| 684 | Partweld=weld(m,handle,Part,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(0.0752487183, -3.95978737, -0.00869596004, 0.999994516, 9.53674999e-007, 1.4901282e-008, 9.53674999e-007, 1.00000763, 6.53699317e-013, 1.4901282e-008, 6.50146603e-013, 0.999988437)) | |
| 685 | Part=part(Enum.FormFactor.Custom,m,Enum.Material.SmoothPlastic,0,0,"Institutional white","Part",Vector3.new(0.34799999, 4.75599957, 0.620599985)) | |
| 686 | Partweld=weld(m,handle,Part,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(-0.000137329102, -3.495821, -0.00869381428, 0.999994516, 9.53674999e-007, 1.4901282e-008, 9.53674999e-007, 1.00000763, 6.53699317e-013, 1.4901282e-008, 6.50146603e-013, 0.999988437)) | |
| 687 | Part=part(Enum.FormFactor.Custom,m,Enum.Material.SmoothPlastic,0,0,"Cool yellow","Part",Vector3.new(3.94400001, 0.579999983, 0.579999983)) | |
| 688 | Partweld=weld(m,handle,Part,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(0.0578308105, -3.95979309, 1.54972076e-005, 0.999994516, 9.53674999e-007, 1.4901282e-008, 9.53674999e-007, 1.00000763, 6.53699317e-013, 1.4901282e-008, 6.50146603e-013, 0.999988437)) | |
| 689 | Part=part(Enum.FormFactor.Custom,m,Enum.Material.SmoothPlastic,0,0,"Cool yellow","Part",Vector3.new(0.579999983, 5.10399961, 0.579999983)) | |
| 690 | Partweld=weld(m,handle,Part,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(-0.000137329102, -3.43782616, 9.41753387e-006, 0.999994516, 9.53674999e-007, 1.4901282e-008, 9.53674999e-007, 1.00000763, 6.53699317e-013, 1.4901282e-008, 6.50146603e-013, 0.999988437)) | |
| 691 | Part=part(Enum.FormFactor.Custom,m,Enum.Material.SmoothPlastic,0,0,"Institutional white","Part",Vector3.new(0.811999977, 0.69599992, 0.812000036)) | |
| 692 | Partweld=weld(m,handle,Part,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(6.86645508e-005, 1.89788628, 9.65595245e-006, 0.999994516, 9.53674999e-007, 1.4901282e-008, 9.53674999e-007, 1.00000763, 6.53699317e-013, 1.4901282e-008, 6.50146603e-013, 0.999988437)) | |
| 693 | mesh("SpecialMesh",Part,Enum.MeshType.Sphere,"",Vector3.new(0, 0, 0),Vector3.new(1, 1, 1))
| |
| 694 | Part=part(Enum.FormFactor.Custom,m,Enum.Material.SmoothPlastic,0,0,"Cool yellow","Part",Vector3.new(0.579999983, 0.811999559, 0.579999983)) | |
| 695 | Partweld=weld(m,handle,Part,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(5.34057617e-005, 1.25990677, 1.13248825e-005, 0.999994516, 9.53674999e-007, 1.4901282e-008, 9.53674999e-007, 1.00000763, 6.53699317e-013, 1.4901282e-008, 6.50146603e-013, 0.999988437)) | |
| 696 | mesh("CylinderMesh",Part,"","",Vector3.new(0, 0, 0),Vector3.new(1, 1, 1))
| |
| 697 | Part=part(Enum.FormFactor.Custom,m,Enum.Material.SmoothPlastic,0,0,"Institutional white","Part",Vector3.new(0.811999977, 0.34799999, 0.812000036)) | |
| 698 | Partweld=weld(m,handle,Part,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(5.7220459e-005, 1.60789871, 1.40666962e-005, 0.999994516, 9.53674999e-007, 1.4901282e-008, 9.53674999e-007, 1.00000763, 6.53699317e-013, 1.4901282e-008, 6.50146603e-013, 0.999988437)) | |
| 699 | mesh("SpecialMesh",Part,Enum.MeshType.Sphere,"",Vector3.new(0, 0, 0),Vector3.new(1, 1, 1))
| |
| 700 | ||
| 701 | function attackone() | |
| 702 | attack = true | |
| 703 | for i = 1,50 do | |
| 704 | so("rbxassetid://270657517",workspace,1,1)
| |
| 705 | end | |
| 706 | for i = 1,40 do | |
| 707 | swait() | |
| 708 | for i = 0,1,0.2 do | |
| 709 | swait() | |
| 710 | RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(-30),math.rad(0),math.rad(0)),.3) | |
| 711 | Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(-30),math.rad(0),math.rad(0)),.3) | |
| 712 | RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(20)), 0.3) | |
| 713 | LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(30), math.rad(0), math.rad(-50)), 0.3) | |
| 714 | RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(20))*angles(math.rad(-5),math.rad(0),math.rad(0)),.3) | |
| 715 | LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(20))*angles(math.rad(-5),math.rad(0),math.rad(0)),.3) | |
| 716 | end | |
| 717 | for i = 0,1,0.2 do | |
| 718 | swait() | |
| 719 | RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(10),math.rad(0),math.rad(0)),.3) | |
| 720 | Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(10),math.rad(0),math.rad(0)),.3) | |
| 721 | RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(50), math.rad(0), math.rad(-20)), 0.3) | |
| 722 | LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(-20)), 0.3) | |
| 723 | RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(-20)),.3) | |
| 724 | LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(-20)),.3) | |
| 725 | end | |
| 726 | for i = 0,1,0.2 do | |
| 727 | swait() | |
| 728 | RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(-30),math.rad(0),math.rad(0)),.3) | |
| 729 | Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(-30),math.rad(0),math.rad(0)),.3) | |
| 730 | RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(20)), 0.3) | |
| 731 | LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(30), math.rad(0), math.rad(-50)), 0.3) | |
| 732 | RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(20))*angles(math.rad(-5),math.rad(0),math.rad(0)),.3) | |
| 733 | LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(20))*angles(math.rad(-5),math.rad(0),math.rad(0)),.3) | |
| 734 | end | |
| 735 | for i = 0,1,0.2 do | |
| 736 | swait() | |
| 737 | RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(10),math.rad(0),math.rad(0)),.3) | |
| 738 | Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(10),math.rad(0),math.rad(0)),.3) | |
| 739 | RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(50), math.rad(0), math.rad(20)), 0.3) | |
| 740 | LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(-20)), 0.3) | |
| 741 | RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(-20)),.3) | |
| 742 | LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(-20)),.3) | |
| 743 | end | |
| 744 | end | |
| 745 | attack = false | |
| 746 | end | |
| 747 | ||
| 748 | mouse.Button1Down:connect(function() | |
| 749 | if attack == false and attacktype == 1 then | |
| 750 | attacktype = 1 | |
| 751 | attackone() | |
| 752 | end | |
| 753 | end) | |
| 754 | ||
| 755 | mouse.KeyDown:connect(function(k) | |
| 756 | k=k:lower() | |
| 757 | if attack == false and k == '' then | |
| 758 | ||
| 759 | end | |
| 760 | end) | |
| 761 | ||
| 762 | local sine = 0 | |
| 763 | local change = 1 | |
| 764 | local val = 0 | |
| 765 | ||
| 766 | while true do | |
| 767 | swait() | |
| 768 | sine = sine + change | |
| 769 | local torvel=(RootPart.Velocity*Vector3.new(1,0,1)).magnitude | |
| 770 | local velderp=RootPart.Velocity.y | |
| 771 | hitfloor,posfloor=rayCast(RootPart.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character) | |
| 772 | if equipped==true or equipped==false then | |
| 773 | if attack==false then | |
| 774 | idle=idle+1 | |
| 775 | else | |
| 776 | idle=0 | |
| 777 | end | |
| 778 | if idle>=500 then | |
| 779 | if attack==false then | |
| 780 | end | |
| 781 | end | |
| 782 | if RootPart.Velocity.y > 1 and hitfloor==nil then | |
| 783 | Anim="Jump" | |
| 784 | if attack==false then | |
| 785 | RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
| 786 | Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
| 787 | RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3) | |
| 788 | LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3) | |
| 789 | RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(0)),.3) | |
| 790 | LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(0)),.3) | |
| 791 | end | |
| 792 | elseif RootPart.Velocity.y < -1 and hitfloor==nil then | |
| 793 | Anim="Fall" | |
| 794 | if attack==false then | |
| 795 | RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
| 796 | Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
| 797 | RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3) | |
| 798 | LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3) | |
| 799 | RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(0)),.3) | |
| 800 | LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(0)),.3) | |
| 801 | end | |
| 802 | elseif torvel<1 and hitfloor~=nil then | |
| 803 | Anim="Idle" | |
| 804 | if attack==false then | |
| 805 | RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
| 806 | Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
| 807 | RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3) | |
| 808 | LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3) | |
| 809 | RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(0)),.3) | |
| 810 | LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(0)),.3) | |
| 811 | end | |
| 812 | elseif torvel>2 and hitfloor~=nil then | |
| 813 | Anim="Walk" | |
| 814 | if attack==false then | |
| 815 | change=3 | |
| 816 | RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
| 817 | Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
| 818 | RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3) | |
| 819 | LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3) | |
| 820 | RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(0)),.3) | |
| 821 | LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(0)),.3) | |
| 822 | end | |
| 823 | end | |
| 824 | end | |
| 825 | if #Effects>0 then | |
| 826 | for e=1,#Effects do | |
| 827 | if Effects[e]~=nil then | |
| 828 | local Thing=Effects[e] | |
| 829 | if Thing~=nil then | |
| 830 | local Part=Thing[1] | |
| 831 | local Mode=Thing[2] | |
| 832 | local Delay=Thing[3] | |
| 833 | local IncX=Thing[4] | |
| 834 | local IncY=Thing[5] | |
| 835 | local IncZ=Thing[6] | |
| 836 | if Thing[1].Transparency<=1 then | |
| 837 | if Thing[2]=="Block1" then | |
| 838 | Thing[1].CFrame=Thing[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) | |
| 839 | Mesh=Thing[1].Mesh | |
| 840 | Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6]) | |
| 841 | Thing[1].Transparency=Thing[1].Transparency+Thing[3] | |
| 842 | elseif Thing[2]=="Cylinder" then | |
| 843 | Mesh=Thing[1].Mesh | |
| 844 | Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6]) | |
| 845 | Thing[1].Transparency=Thing[1].Transparency+Thing[3] | |
| 846 | elseif Thing[2]=="Blood" then | |
| 847 | Mesh=Thing[7] | |
| 848 | Thing[1].CFrame=Thing[1].CFrame*cf(0,.5,0) | |
| 849 | Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6]) | |
| 850 | Thing[1].Transparency=Thing[1].Transparency+Thing[3] | |
| 851 | elseif Thing[2]=="Elec" then | |
| 852 | Mesh=Thing[1].Mesh | |
| 853 | Mesh.Scale=Mesh.Scale+vt(Thing[7],Thing[8],Thing[9]) | |
| 854 | Thing[1].Transparency=Thing[1].Transparency+Thing[3] | |
| 855 | elseif Thing[2]=="Disappear" then | |
| 856 | Thing[1].Transparency=Thing[1].Transparency+Thing[3] | |
| 857 | end | |
| 858 | else | |
| 859 | Part.Parent=nil | |
| 860 | table.remove(Effects,e) | |
| 861 | end | |
| 862 | end | |
| 863 | end | |
| 864 | end | |
| 865 | end | |
| 866 | end |