SHOW:
|
|
- or go back to the newest paste.
| 1 | - | -- This script has been converted to FE by iPxter |
| 1 | + | --https://github.com/Mokiros/roblox-FE-compatibility |
| 2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 3 | local Player,game,owner = owner,game | |
| 4 | local RealPlayer = Player | |
| 5 | - | local Player,Mouse,mouse,UserInputService,ContextActionService = owner |
| 5 | + | |
| 6 | print("FE Compatibility code V2 by Mokiros")
| |
| 7 | - | print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
|
| 7 | + | local RealPlayer = RealPlayer |
| 8 | - | script.Parent = Player.Character |
| 8 | + | script.Parent = RealPlayer.Character |
| 9 | ||
| 10 | - | --RemoteEvent for communicating |
| 10 | + | |
| 11 | local Disconnect_Function = function(this) | |
| 12 | this[1].Functions[this[2]] = nil | |
| 13 | end | |
| 14 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
| |
| 15 | local FakeEvent_Metatable = {__index={
| |
| 16 | - | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
|
| 16 | + | Connect = function(this,f) |
| 17 | - | t.connect = t.Connect |
| 17 | + | local i = tostring(math.random(0,10000)) |
| 18 | - | return t |
| 18 | + | while this.Functions[i] do |
| 19 | i = tostring(math.random(0,10000)) | |
| 20 | end | |
| 21 | this.Functions[i] = f | |
| 22 | - | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
|
| 22 | + | return setmetatable({this,i},Disconnect_Metatable)
|
| 23 | end | |
| 24 | }} | |
| 25 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
| 26 | local function fakeEvent() | |
| 27 | return setmetatable({Functions={}},FakeEvent_Metatable)
| |
| 28 | end | |
| 29 | ||
| 30 | --Creating fake input objects with fake variables | |
| 31 | - | local function te(self,ev,...) |
| 31 | + | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
|
| 32 | - | local t = m[ev] |
| 32 | + | FakeMouse.keyUp = FakeMouse.KeyUp |
| 33 | - | if t and t._fakeEvent and t.Function then |
| 33 | + | FakeMouse.keyDown = FakeMouse.KeyDown |
| 34 | - | t.Function(...) |
| 34 | + | |
| 35 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 36 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 37 | - | m.TrigEvent = te |
| 37 | + | |
| 38 | - | UIS.TrigEvent = te |
| 38 | + | |
| 39 | CAS.UnbindAction = CAS.BindAction | |
| 40 | ||
| 41 | - | if plr~=Player then return end |
| 41 | + | |
| 42 | - | if io.isMouse then |
| 42 | + | local function TriggerEvent(self,ev,...) |
| 43 | - | m.Target = io.Target |
| 43 | + | for _,f in pairs(self[ev].Functions) do |
| 44 | - | m.Hit = io.Hit |
| 44 | + | f(...) |
| 45 | end | |
| 46 | end | |
| 47 | FakeMouse.TriggerEvent = TriggerEvent | |
| 48 | - | return m:TrigEvent(b and "Button1Down" or "Button1Up") |
| 48 | + | UIS.TriggerEvent = TriggerEvent |
| 49 | ||
| 50 | --Client communication | |
| 51 | local Event = Instance.new("RemoteEvent")
| |
| 52 | Event.Name = "UserInput_Event" | |
| 53 | Event.OnServerEvent:Connect(function(plr,io) | |
| 54 | if plr~=RealPlayer then return end | |
| 55 | FakeMouse.Target = io.Target | |
| 56 | FakeMouse.Hit = io.Hit | |
| 57 | - | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) |
| 57 | + | if not io.isMouse then |
| 58 | - | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) |
| 58 | + | |
| 59 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 60 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
| 61 | - | Event.Parent = NLS([==[ |
| 61 | + | |
| 62 | - | local Player = owner |
| 62 | + | if io.UserInputType == Enum.UserInputType.MouseButton2 then |
| 63 | - | local Event = script:WaitForChild("UserInput_Event")
|
| 63 | + | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") |
| 64 | end | |
| 65 | for _,t in pairs(CAS.Actions) do | |
| 66 | - | local input = function(io,a) |
| 66 | + | |
| 67 | - | if a then return end |
| 67 | + | |
| 68 | t.Function(t.Name,io.UserInputState,io) | |
| 69 | - | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
|
| 69 | + | |
| 70 | end | |
| 71 | end | |
| 72 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 73 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 74 | - | local Mouse = Player:GetMouse() |
| 74 | + | |
| 75 | end) | |
| 76 | - | --Give the server mouse data 30 times every second, but only if the values changed |
| 76 | + | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
|
| 77 | local Mouse = owner:GetMouse() | |
| 78 | - | while wait(1/30) do |
| 78 | + | |
| 79 | local input = function(io,RobloxHandled) | |
| 80 | if RobloxHandled then return end | |
| 81 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 82 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 83 | - | end]==],Player.Character) |
| 83 | + | |
| 84 | - | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS |
| 84 | + | |
| 85 | UIS.InputEnded:Connect(input) | |
| 86 | local h,t | |
| 87 | --Give the server mouse data every second frame, but only if the values changed | |
| 88 | --If player is not moving their mouse, client won't fire events | |
| 89 | - | local Player = owner |
| 89 | + | local HB = game:GetService("RunService").Heartbeat
|
| 90 | while true do | |
| 91 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 92 | h,t=Mouse.Hit,Mouse.Target | |
| 93 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 94 | end | |
| 95 | --Wait 2 frames | |
| 96 | for i=1,2 do | |
| 97 | HB:Wait() | |
| 98 | end | |
| 99 | end]==],script) | |
| 100 | ||
| 101 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 102 | --Real game object | |
| 103 | local RealGame = game | |
| 104 | ||
| 105 | --Metatable for fake service | |
| 106 | local FakeService_Metatable = {
| |
| 107 | __index = function(self,k) | |
| 108 | local s = rawget(self,"_RealService") | |
| 109 | if s then | |
| 110 | return typeof(s[k])=="function" | |
| 111 | and function(_,...)return s[k](s,...)end or s[k] | |
| 112 | end | |
| 113 | end, | |
| 114 | __newindex = function(self,k,v) | |
| 115 | local s = rawget(self,"_RealService") | |
| 116 | if s then s[k]=v end | |
| 117 | end | |
| 118 | } | |
| 119 | local function FakeService(t,RealService) | |
| 120 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
| 121 | return setmetatable(t,FakeService_Metatable) | |
| 122 | end | |
| 123 | ||
| 124 | --Fake game object | |
| 125 | local FakeGame = {
| |
| 126 | GetService = function(self,s) | |
| 127 | return rawget(self,s) or RealGame:GetService(s) | |
| 128 | end, | |
| 129 | Players = FakeService({
| |
| 130 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
| |
| 131 | },"Players"), | |
| 132 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 133 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 134 | RunService = FakeService({
| |
| 135 | _btrs = {},
| |
| 136 | RenderStepped = RealGame:GetService("RunService").Heartbeat,
| |
| 137 | BindToRenderStep = function(self,name,_,fun) | |
| 138 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 139 | end, | |
| 140 | UnbindFromRenderStep = function(self,name) | |
| 141 | self._btrs[name]:Disconnect() | |
| 142 | end, | |
| 143 | },"RunService") | |
| 144 | } | |
| 145 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
| 146 | FakeGame.service = FakeGame.GetService | |
| 147 | FakeService(FakeGame,game) | |
| 148 | --Changing owner to fake player object to support owner:GetMouse() | |
| 149 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
| 150 | end | |
| 151 | --[[Nocturna_A._Alteriano_Night.Owl.Inc]]-- | |
| 152 | wait(1 / 60) | |
| 153 | Effects = { }
| |
| 154 | local Player = game.Players.localPlayer | |
| 155 | local Character = Player.Character | |
| 156 | local Humanoid = Character.Humanoid | |
| 157 | local mouse = Player:GetMouse() | |
| 158 | local m = Instance.new('Model', Character)
| |
| 159 | m.Name = "WeaponModel" | |
| 160 | local LeftArm = Character["Left Arm"] | |
| 161 | local RightArm = Character["Right Arm"] | |
| 162 | local LeftLeg = Character["Left Leg"] | |
| 163 | local RightLeg = Character["Right Leg"] | |
| 164 | local Head = Character.Head | |
| 165 | local Torso = Character.Torso | |
| 166 | local cam = game.Workspace.CurrentCamera | |
| 167 | local RootPart = Character.HumanoidRootPart | |
| 168 | local RootJoint = RootPart.RootJoint | |
| 169 | local equipped = false | |
| 170 | local attack = false | |
| 171 | local Anim = 'Idle' | |
| 172 | local idle = 0 | |
| 173 | local attacktype = 1 | |
| 174 | local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude | |
| 175 | local velocity = RootPart.Velocity.y | |
| 176 | local sine = 0 | |
| 177 | local change = 1 | |
| 178 | local grabbed = false | |
| 179 | local cn = CFrame.new | |
| 180 | local mr = math.rad | |
| 181 | local angles = CFrame.Angles | |
| 182 | local ud = UDim2.new | |
| 183 | local c3 = Color3.new | |
| 184 | ||
| 185 | p = game.Players.LocalPlayer | |
| 186 | char = p.Character | |
| 187 | local txt = Instance.new("BillboardGui", char)
| |
| 188 | txt.Adornee = char .Head | |
| 189 | txt.Name = "_status" | |
| 190 | txt.Size = UDim2.new(2, 0, 1.2, 0) | |
| 191 | txt.StudsOffset = Vector3.new(-9, 8, 0) | |
| 192 | local text = Instance.new("TextLabel", txt)
| |
| 193 | text.Size = UDim2.new(10, 0, 7, 0) | |
| 194 | text.FontSize = "Size24" | |
| 195 | text.TextScaled = true | |
| 196 | text.TextTransparency = 0 | |
| 197 | text.BackgroundTransparency = 1 | |
| 198 | text.TextTransparency = 0 | |
| 199 | text.TextStrokeTransparency = 0 | |
| 200 | text.Font = "Cartoon" | |
| 201 | text.TextStrokeColor3 = Color3.new(10,0,0) | |
| 202 | ||
| 203 | v=Instance.new("Part")
| |
| 204 | v.Name = "ColorBrick" | |
| 205 | v.Parent=p.Character | |
| 206 | v.FormFactor="Symmetric" | |
| 207 | v.Anchored=true | |
| 208 | v.CanCollide=false | |
| 209 | v.BottomSurface="Smooth" | |
| 210 | v.TopSurface="Smooth" | |
| 211 | v.Size=Vector3.new(10,5,3) | |
| 212 | v.Transparency=1 | |
| 213 | v.CFrame=char.Torso.CFrame | |
| 214 | v.BrickColor=BrickColor.new(CV) | |
| 215 | v.Transparency=1 | |
| 216 | text.TextColor3 = Color3.new(10,0,0) | |
| 217 | v.Shape="Block" | |
| 218 | text.Text = "Kitchen Gun " | |
| 219 | ||
| 220 | local s = Instance.new("Sound",char)
| |
| 221 | s.Name = "BGMusic" | |
| 222 | s.SoundId = "rbxassetid://570949013" | |
| 223 | s.Pitch = 1 | |
| 224 | s.Volume = 4 | |
| 225 | s.Looped = true | |
| 226 | s.archivable = false | |
| 227 | s.Parent = char.Head | |
| 228 | wait(0.1) | |
| 229 | s:play() | |
| 230 | ||
| 231 | Humanoid.Animator.Parent = nil | |
| 232 | Character.Animate.Parent = nil | |
| 233 | ||
| 234 | local newMotor = function(part0, part1, c0, c1) | |
| 235 | local w = Instance.new('Motor', part0)
| |
| 236 | w.Part0 = part0 | |
| 237 | w.Part1 = part1 | |
| 238 | w.C0 = c0 | |
| 239 | w.C1 = c1 | |
| 240 | return w | |
| 241 | end | |
| 242 | ||
| 243 | function clerp(a, b, t) | |
| 244 | return a:lerp(b, t) | |
| 245 | end | |
| 246 | ||
| 247 | RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14) | |
| 248 | NeckCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
| 249 | ||
| 250 | local RW = newMotor(Torso, RightArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0)) | |
| 251 | local LW = newMotor(Torso, LeftArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0)) | |
| 252 | local RH = newMotor(Torso, RightLeg, CFrame.new(.5, -2, 0), CFrame.new(0, 0, 0)) | |
| 253 | local LH = newMotor(Torso, LeftLeg, CFrame.new(-.5, -2, 0), CFrame.new(0, 0, 0)) | |
| 254 | RootJoint.C1 = CFrame.new(0, 0, 0) | |
| 255 | RootJoint.C0 = CFrame.new(0, 0, 0) | |
| 256 | Torso.Neck.C1 = CFrame.new(0, 0, 0) | |
| 257 | Torso.Neck.C0 = CFrame.new(0, 1.5, 0) | |
| 258 | ||
| 259 | local rarmc1 = RW.C1 | |
| 260 | local larmc1 = LW.C1 | |
| 261 | local rlegc1 = RH.C1 | |
| 262 | local llegc1 = LH.C1 | |
| 263 | ||
| 264 | local resetc1 = false | |
| 265 | ||
| 266 | function PlayAnimationFromTable(table, speed, bool) | |
| 267 | RootJoint.C0 = clerp(RootJoint.C0, table[1], speed) | |
| 268 | Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed) | |
| 269 | RW.C0 = clerp(RW.C0, table[3], speed) | |
| 270 | LW.C0 = clerp(LW.C0, table[4], speed) | |
| 271 | RH.C0 = clerp(RH.C0, table[5], speed) | |
| 272 | LH.C0 = clerp(LH.C0, table[6], speed) | |
| 273 | if bool == true then | |
| 274 | if resetc1 == false then | |
| 275 | resetc1 = true | |
| 276 | RootJoint.C1 = RootJoint.C1 | |
| 277 | Torso.Neck.C1 = Torso.Neck.C1 | |
| 278 | RW.C1 = rarmc1 | |
| 279 | LW.C1 = larmc1 | |
| 280 | RH.C1 = rlegc1 | |
| 281 | LH.C1 = llegc1 | |
| 282 | end | |
| 283 | end | |
| 284 | end | |
| 285 | ||
| 286 | --[[Credits to SazErenos for his Artificial Heartbeat]]-- | |
| 287 | ||
| 288 | ArtificialHB = Instance.new("BindableEvent", script)
| |
| 289 | ArtificialHB.Name = "Heartbeat" | |
| 290 | ||
| 291 | script:WaitForChild("Heartbeat")
| |
| 292 | ||
| 293 | frame = 1 / 30 | |
| 294 | tf = 0 | |
| 295 | allowframeloss = false | |
| 296 | tossremainder = false | |
| 297 | lastframe = tick() | |
| 298 | script.Heartbeat:Fire() | |
| 299 | ||
| 300 | game:GetService("RunService").Heartbeat:connect(function(s, p)
| |
| 301 | tf = tf + s | |
| 302 | if tf >= frame then | |
| 303 | if allowframeloss then | |
| 304 | script.Heartbeat:Fire() | |
| 305 | lastframe = tick() | |
| 306 | else | |
| 307 | for i = 1, math.floor(tf / frame) do | |
| 308 | script.Heartbeat:Fire() | |
| 309 | end | |
| 310 | lastframe = tick() | |
| 311 | end | |
| 312 | if tossremainder then | |
| 313 | tf = 0 | |
| 314 | else | |
| 315 | tf = tf - frame * math.floor(tf / frame) | |
| 316 | end | |
| 317 | end | |
| 318 | end) | |
| 319 | ||
| 320 | function swait(num) | |
| 321 | if num == 0 or num == nil then | |
| 322 | ArtificialHB.Event:wait() | |
| 323 | else | |
| 324 | for i = 0, num do | |
| 325 | ArtificialHB.Event:wait() | |
| 326 | end | |
| 327 | end | |
| 328 | end | |
| 329 | ||
| 330 | local RbxUtility = LoadLibrary("RbxUtility")
| |
| 331 | local Create = RbxUtility.Create | |
| 332 | ||
| 333 | function RemoveOutlines(part) | |
| 334 | part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10 | |
| 335 | end | |
| 336 | ||
| 337 | CFuncs = {
| |
| 338 | ["Part"] = {
| |
| 339 | Create = function(Parent, Material, Reflectance, Transparency, BColor, Name, Size) | |
| 340 | local Part = Create("Part"){
| |
| 341 | Parent = Parent, | |
| 342 | Reflectance = Reflectance, | |
| 343 | Transparency = Transparency, | |
| 344 | CanCollide = false, | |
| 345 | Locked = true, | |
| 346 | BrickColor = BrickColor.new(tostring(BColor)), | |
| 347 | Name = Name, | |
| 348 | Size = Size, | |
| 349 | Material = Material, | |
| 350 | } | |
| 351 | RemoveOutlines(Part) | |
| 352 | return Part | |
| 353 | end; | |
| 354 | }; | |
| 355 | ||
| 356 | ["Mesh"] = {
| |
| 357 | Create = function(Mesh, Part, MeshType, MeshId, OffSet, Scale) | |
| 358 | local Msh = Create(Mesh){
| |
| 359 | Parent = Part, | |
| 360 | Offset = OffSet, | |
| 361 | Scale = Scale, | |
| 362 | } | |
| 363 | if Mesh == "SpecialMesh" then | |
| 364 | Msh.MeshType = MeshType | |
| 365 | Msh.MeshId = MeshId | |
| 366 | end | |
| 367 | return Msh | |
| 368 | end; | |
| 369 | }; | |
| 370 | ||
| 371 | ["Mesh"] = {
| |
| 372 | Create = function(Mesh, Part, MeshType, MeshId, OffSet, Scale) | |
| 373 | local Msh = Create(Mesh){
| |
| 374 | Parent = Part, | |
| 375 | Offset = OffSet, | |
| 376 | Scale = Scale, | |
| 377 | } | |
| 378 | if Mesh == "SpecialMesh" then | |
| 379 | Msh.MeshType = MeshType | |
| 380 | Msh.MeshId = MeshId | |
| 381 | end | |
| 382 | return Msh | |
| 383 | end; | |
| 384 | }; | |
| 385 | ||
| 386 | ["Weld"] = {
| |
| 387 | Create = function(Parent, Part0, Part1, C0, C1) | |
| 388 | local Weld = Create("Weld"){
| |
| 389 | Parent = Parent, | |
| 390 | Part0 = Part0, | |
| 391 | Part1 = Part1, | |
| 392 | C0 = C0, | |
| 393 | C1 = C1, | |
| 394 | } | |
| 395 | return Weld | |
| 396 | end; | |
| 397 | }; | |
| 398 | ||
| 399 | ["Sound"] = {
| |
| 400 | Create = function(id, par, vol, pit) | |
| 401 | coroutine.resume(coroutine.create(function() | |
| 402 | local S = Create("Sound"){
| |
| 403 | Volume = vol, | |
| 404 | Pitch = pit or 1, | |
| 405 | SoundId = id, | |
| 406 | Parent = par or workspace, | |
| 407 | } | |
| 408 | Instance.new("DistortionSoundEffect", S).Level = 1
| |
| 409 | wait() | |
| 410 | S:play() | |
| 411 | game:GetService("Debris"):AddItem(S, 10)
| |
| 412 | end)) | |
| 413 | end; | |
| 414 | }; | |
| 415 | ||
| 416 | ["ParticleEmitter"] = {
| |
| 417 | Create = function(Parent, Color1, Color2, LightEmission, Size, Texture, Transparency, ZOffset, Accel, Drag, LockedToPart, VelocityInheritance, EmissionDirection, Enabled, LifeTime, Rate, Rotation, RotSpeed, Speed, VelocitySpread) | |
| 418 | local fp = Create("ParticleEmitter"){
| |
| 419 | Parent = Parent, | |
| 420 | Color = ColorSequence.new(Color1, Color2), | |
| 421 | LightEmission = LightEmission, | |
| 422 | Size = Size, | |
| 423 | Texture = Texture, | |
| 424 | Transparency = Transparency, | |
| 425 | ZOffset = ZOffset, | |
| 426 | Acceleration = Accel, | |
| 427 | Drag = Drag, | |
| 428 | LockedToPart = LockedToPart, | |
| 429 | VelocityInheritance = VelocityInheritance, | |
| 430 | EmissionDirection = EmissionDirection, | |
| 431 | Enabled = Enabled, | |
| 432 | Lifetime = LifeTime, | |
| 433 | Rate = Rate, | |
| 434 | Rotation = Rotation, | |
| 435 | RotSpeed = RotSpeed, | |
| 436 | Speed = Speed, | |
| 437 | VelocitySpread = VelocitySpread, | |
| 438 | } | |
| 439 | return fp | |
| 440 | end; | |
| 441 | }; | |
| 442 | } | |
| 443 | ||
| 444 | function rayCast(Position, Direction, Range, Ignore) | |
| 445 | return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
| |
| 446 | end | |
| 447 | ||
| 448 | local function GetNearest(obj, distance) | |
| 449 | local last, lastx = distance + 1 | |
| 450 | for i, v in pairs(workspace:GetChildren()) do | |
| 451 | if v:IsA'Model' and v ~= Character and v:findFirstChild('Humanoid') and v:findFirstChild('Torso') and v:findFirstChild('Humanoid').Health > 0 then
| |
| 452 | local t = v.Torso | |
| 453 | local dist = (t.Position - obj.Position).magnitude | |
| 454 | if dist <= distance then | |
| 455 | if dist < last then | |
| 456 | last = dist | |
| 457 | lastx = v | |
| 458 | end | |
| 459 | end | |
| 460 | end | |
| 461 | end | |
| 462 | return lastx | |
| 463 | end | |
| 464 | ||
| 465 | --[[ Credits to Kert109 (Ninja_Deer) for the Damage function. Fenrier for the Magnitude Damage ]]-- | |
| 466 | ||
| 467 | function Damage(hit, damage, cooldown, Color1, Color2, HSound, HPitch) | |
| 468 | for i, v in pairs(hit:GetChildren()) do | |
| 469 | if v:IsA("Humanoid") and hit.Name ~= Character.Name then
| |
| 470 | local find = v:FindFirstChild("DebounceHit")
| |
| 471 | if not find then | |
| 472 | if v.Parent:findFirstChild("Head") then
| |
| 473 | local BillG = Create("BillboardGui"){
| |
| 474 | Parent = v.Parent.Head, | |
| 475 | Size = UDim2.new(1, 0, 1, 0), | |
| 476 | Adornee = v.Parent.Head, | |
| 477 | StudsOffset = Vector3.new(math.random(-3, 3), math.random(3, 5), math.random(-3, 3)), | |
| 478 | } | |
| 479 | local TL = Create("TextLabel"){
| |
| 480 | Parent = BillG, | |
| 481 | Size = UDim2.new(3, 3, 3, 3), | |
| 482 | BackgroundTransparency = 1, | |
| 483 | Text = tostring(damage).."-", | |
| 484 | TextColor3 = Color1.Color, | |
| 485 | TextStrokeColor3 = Color2.Color, | |
| 486 | TextStrokeTransparency = 0, | |
| 487 | TextXAlignment = Enum.TextXAlignment.Center, | |
| 488 | TextYAlignment = Enum.TextYAlignment.Center, | |
| 489 | FontSize = Enum.FontSize.Size18, | |
| 490 | Font = "ArialBold", | |
| 491 | } | |
| 492 | coroutine.resume(coroutine.create(function() | |
| 493 | swait(1) | |
| 494 | for i = 0, 1, .1 do | |
| 495 | swait(.1) | |
| 496 | BillG.StudsOffset = BillG.StudsOffset + Vector3.new(0, .1, 0) | |
| 497 | end | |
| 498 | BillG:Destroy() | |
| 499 | end)) | |
| 500 | end | |
| 501 | v.Health = v.Health - damage | |
| 502 | local bool = Create("BoolValue"){
| |
| 503 | Parent = v, | |
| 504 | Name = "DebounceHit", | |
| 505 | } | |
| 506 | if HSound ~= nil and HPitch ~= nil then | |
| 507 | CFuncs["Sound"].Create(HSound, hit, 1, HPitch) | |
| 508 | end | |
| 509 | game:GetService("Debris"):AddItem(bool, cooldown)
| |
| 510 | end | |
| 511 | end | |
| 512 | end | |
| 513 | end | |
| 514 | ||
| 515 | function MagnitudeDamage(Part, magni, mindam, maxdam, Color1, Color2, HSound, HPitch) | |
| 516 | for _, c in pairs(workspace:children()) do | |
| 517 | local hum = c:findFirstChild("Humanoid")
| |
| 518 | if hum ~= nil then | |
| 519 | local head = c:findFirstChild("Torso")
| |
| 520 | if head ~= nil then | |
| 521 | local targ = head.Position - Part.Position | |
| 522 | local mag = targ.magnitude | |
| 523 | if mag <= magni and c.Name ~= Player.Name then | |
| 524 | Damage(head.Parent, math.random(mindam, maxdam), 0.5, Color1, Color2, HSound, HPitch) | |
| 525 | end | |
| 526 | end | |
| 527 | end | |
| 528 | end | |
| 529 | end | |
| 530 | ||
| 531 | Handle = CFuncs["Part"].Create(m, Enum.Material.SmoothPlastic, 0, 1, "Medium stone grey", "Handle", Vector3.new(0.399999946, 0.899999976, 0.400000095)) | |
| 532 | HandleWeld = CFuncs["Weld"].Create(m, Character["Right Arm"], Handle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.199958801, -0.0500774384, -1.09998882, -1, 0, 0, 0, 0, -1, -0, -1, -0)) | |
| 533 | FakeHandle = CFuncs["Part"].Create(m, Enum.Material.SmoothPlastic, 0, 1, "Medium stone grey", "FakeHandle", Vector3.new(0.399999946, 0.899999976, 0.400000095)) | |
| 534 | FakeHandleWeld = CFuncs["Weld"].Create(m, Handle, FakeHandle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.199996948, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 535 | Barrel = CFuncs["Part"].Create(m, Enum.Material.SmoothPlastic, 0, 1, "Medium stone grey", "Barrel", Vector3.new(0.399999946, 0.399999976, 0.400000095)) | |
| 536 | BarrelWeld = CFuncs["Weld"].Create(m, FakeHandle, Barrel, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, -0.749999046, -1.50000024, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 537 | Part = CFuncs["Part"].Create(m, Enum.Material.SmoothPlastic, 0, 0, "Medium stone grey", "Part", Vector3.new(0.399999946, 0.299999952, 0.400000095)) | |
| 538 | PartWeld = CFuncs["Weld"].Create(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, -0.300000191, -0.400000095, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 539 | CFuncs["Mesh"].Create("SpecialMesh", Part, Enum.MeshType.FileMesh, "rbxassetid://435840330", Vector3.new(0, 0, 0), Vector3.new(0.00200000009, 0.00200000009, 0.00200000009))
| |
| 540 | Part.Mesh.TextureId = "rbxassetid://435840335" | |
| 541 | ||
| 542 | EffectModel = Instance.new("Model", Character)
| |
| 543 | EffectModel.Name = "Effects" | |
| 544 | ||
| 545 | Effects = {
| |
| 546 | ["Block"] = {
| |
| 547 | Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, Type) | |
| 548 | local prt = CFuncs["Part"].Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new()) | |
| 549 | prt.Anchored = true | |
| 550 | prt.CFrame = cframe | |
| 551 | local msh = CFuncs["Mesh"].Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
| |
| 552 | game:GetService("Debris"):AddItem(prt, 10)
| |
| 553 | if Type == 1 or Type == nil then | |
| 554 | table.insert(Effects, {
| |
| 555 | prt, | |
| 556 | "Block1", | |
| 557 | delay, | |
| 558 | x3, | |
| 559 | y3, | |
| 560 | z3, | |
| 561 | msh | |
| 562 | }) | |
| 563 | elseif Type == 2 then | |
| 564 | table.insert(Effects, {
| |
| 565 | prt, | |
| 566 | "Block2", | |
| 567 | delay, | |
| 568 | x3, | |
| 569 | y3, | |
| 570 | z3, | |
| 571 | msh | |
| 572 | }) | |
| 573 | end | |
| 574 | end; | |
| 575 | }; | |
| 576 | ||
| 577 | ["Cylinder"] = {
| |
| 578 | Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay) | |
| 579 | local prt = CFuncs["Part"].Create(workspace, "Neon", 0, 0, brickcolor, "Effect", Vector3.new(0.2, 0.2, 0.2)) | |
| 580 | prt.Anchored = true | |
| 581 | prt.CFrame = cframe | |
| 582 | local msh = CFuncs["Mesh"].Create("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
| |
| 583 | game:GetService("Debris"):AddItem(prt, 2)
| |
| 584 | Effects[#Effects + 1] = {
| |
| 585 | prt, | |
| 586 | "Cylinder", | |
| 587 | delay, | |
| 588 | x3, | |
| 589 | y3, | |
| 590 | z3 | |
| 591 | } | |
| 592 | end; | |
| 593 | }; | |
| 594 | ||
| 595 | ["Sphere"] = {
| |
| 596 | Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay) | |
| 597 | local prt = CFuncs["Part"].Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new()) | |
| 598 | prt.Anchored = true | |
| 599 | prt.CFrame = cframe | |
| 600 | local msh = CFuncs["Mesh"].Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
| |
| 601 | game:GetService("Debris"):AddItem(prt, 10)
| |
| 602 | table.insert(Effects, {
| |
| 603 | prt, | |
| 604 | "Cylinder", | |
| 605 | delay, | |
| 606 | x3, | |
| 607 | y3, | |
| 608 | z3, | |
| 609 | msh | |
| 610 | }) | |
| 611 | end; | |
| 612 | }; | |
| 613 | ||
| 614 | ["Elec"] = {
| |
| 615 | Create = function(cff, x, y, z) | |
| 616 | local prt = CFuncs["Part"].Create(workspace, "Neon", 0, 0, BrickColor.new("Lime green"), "Part", Vector3.new(1, 1, 1))
| |
| 617 | prt.Anchored = true | |
| 618 | prt.CFrame = cff * CFrame.new(math.random(-x, x), math.random(-y, y), math.random(-z, z)) | |
| 619 | prt.CFrame = CFrame.new(prt.Position) | |
| 620 | game:GetService("Debris"):AddItem(prt, 2)
| |
| 621 | local xval = math.random() / 2 | |
| 622 | local yval = math.random() / 2 | |
| 623 | local zval = math.random() / 2 | |
| 624 | local msh = CFuncs["Mesh"].Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(xval, yval, zval))
| |
| 625 | table.insert(Effects, {
| |
| 626 | prt, | |
| 627 | "Elec", | |
| 628 | 0.1, | |
| 629 | x, | |
| 630 | y, | |
| 631 | z, | |
| 632 | xval, | |
| 633 | yval, | |
| 634 | zval | |
| 635 | }) | |
| 636 | end; | |
| 637 | ||
| 638 | }; | |
| 639 | ||
| 640 | ["Ring"] = {
| |
| 641 | Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay) | |
| 642 | local prt = CFuncs["Part"].Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new()) | |
| 643 | prt.Anchored = true | |
| 644 | prt.CFrame = cframe | |
| 645 | local msh = CFuncs["Mesh"].Create("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
| |
| 646 | game:GetService("Debris"):AddItem(prt, 10)
| |
| 647 | table.insert(Effects, {
| |
| 648 | prt, | |
| 649 | "Cylinder", | |
| 650 | delay, | |
| 651 | x3, | |
| 652 | y3, | |
| 653 | z3, | |
| 654 | msh | |
| 655 | }) | |
| 656 | end; | |
| 657 | }; | |
| 658 | ||
| 659 | ||
| 660 | ["Wave"] = {
| |
| 661 | Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay) | |
| 662 | local prt = CFuncs["Part"].Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new()) | |
| 663 | prt.Anchored = true | |
| 664 | prt.CFrame = cframe | |
| 665 | local msh = CFuncs["Mesh"].Create("SpecialMesh", prt, "FileMesh", "rbxassetid://20329976", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
| |
| 666 | game:GetService("Debris"):AddItem(prt, 10)
| |
| 667 | table.insert(Effects, {
| |
| 668 | prt, | |
| 669 | "Cylinder", | |
| 670 | delay, | |
| 671 | x3, | |
| 672 | y3, | |
| 673 | z3, | |
| 674 | msh | |
| 675 | }) | |
| 676 | end; | |
| 677 | }; | |
| 678 | ||
| 679 | ["Break"] = {
| |
| 680 | Create = function(brickcolor, cframe, x1, y1, z1) | |
| 681 | local prt = CFuncs["Part"].Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new(0.5, 0.5, 0.5)) | |
| 682 | prt.Anchored = true | |
| 683 | prt.CFrame = cframe * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)) | |
| 684 | local msh = CFuncs["Mesh"].Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
| |
| 685 | local num = math.random(10, 50) / 1000 | |
| 686 | game:GetService("Debris"):AddItem(prt, 10)
| |
| 687 | table.insert(Effects, {
| |
| 688 | prt, | |
| 689 | "Shatter", | |
| 690 | num, | |
| 691 | prt.CFrame, | |
| 692 | math.random() - math.random(), | |
| 693 | 0, | |
| 694 | math.random(50, 100) / 100 | |
| 695 | }) | |
| 696 | end; | |
| 697 | }; | |
| 698 | } | |
| 699 | ||
| 700 | Shoot2 = function(orgpos) | |
| 701 | local MouseLook = CFrame.new((orgpos + mouse.Hit.p) / 2, mouse.Hit.p) | |
| 702 | Effects["Sphere"].Create(BrickColor.new("New Yeller"), CFrame.new(orgpos), 5, 5, 5, 3, 3, 3, 0.1)
| |
| 703 | table.insert(Effects, {
| |
| 704 | MouseLook.lookVector, | |
| 705 | "Shoot2", | |
| 706 | 50, | |
| 707 | orgpos, | |
| 708 | 5, | |
| 709 | 7, | |
| 710 | 0, | |
| 711 | 1, | |
| 712 | 2 | |
| 713 | }) | |
| 714 | end | |
| 715 | ||
| 716 | function attackone() | |
| 717 | attack = true | |
| 718 | CFuncs["Sound"].Create("rbxassetid://243053454", Torso, .1, 2.8)
| |
| 719 | for i = 0, 1, 0.025 do | |
| 720 | swait() | |
| 721 | PlayAnimationFromTable({
| |
| 722 | CFrame.new(-0, -0, -0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 723 | CFrame.new(0, 1.4999907, 3.42726707e-007, 1, 0, 0, 0, 0.996194661, 0.087155968, 0, -0.087155968, 0.996194661) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 724 | CFrame.new(0.431798398, 0.400000006, -0.888215482, 0.939692736, 0.342019886, 0, 0, 0, -1, -0.342019916, 0.939692736, 0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 725 | CFrame.new(-0.559965074, 0.300000012, -0.828456283, 0.939692736, -0.342019886, 0, 0, 0, -1, 0.342019916, 0.939692736, 0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 726 | CFrame.new(0.599619746, -1.99127948, 0, 0.996194661, -0.087155968, 0, 0.087155968, 0.996194661, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 727 | CFrame.new(-0.599619746, -1.99127901, 0, 0.996194661, 0.087155968, 0, -0.087155968, 0.996194661, 0, -0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 728 | }, .3, false) | |
| 729 | FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-20), math.rad(0)), 0.3) | |
| 730 | end | |
| 731 | CFuncs["Sound"].Create("rbxassetid://203691837", Barrel, .01, .3)
| |
| 732 | CFuncs["Sound"].Create("rbxassetid://131384028", Barrel, .01, .9)
| |
| 733 | CFuncs["Sound"].Create("rbxassetid://184718741", Barrel, .05, .9)
| |
| 734 | Shoot2(Barrel.Position) | |
| 735 | for i = 0, 1, 0.15 do | |
| 736 | swait() | |
| 737 | RootPart.Velocity = RootPart.CFrame.lookVector * -50 | |
| 738 | PlayAnimationFromTable({
| |
| 739 | CFrame.new(-0, -0.281125277, 0.157014638, 1, 0, -0, 0, 0.906307876, -0.422617942, 0, 0.422617942, 0.906307876) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 740 | CFrame.new(0, 1.4999938, 1.05202198e-005, 1, 0, -0, 0, 0.965925813, 0.258818924, -0, -0.258818924, 0.965925813) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 741 | CFrame.new(0.406597674, 0.817824185, -0.957423151, 0.939692974, 0.280165672, -0.196174338, -5.36441803e-007, -0.573575616, -0.819152534, -0.34201926, 0.769751906, -0.538984895) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 742 | CFrame.new(-0.506752789, 0.775180221, -0.974653006, 0.939692974, -0.280165732, 0.196174279, 5.36441803e-007, -0.573575556, -0.819152713, 0.34201926, 0.769752145, -0.538984716) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 743 | CFrame.new(0.566868722, -1.61683154, -0.13679418, 0.954536259, -0.174988821, -0.241328761, 0.172366679, 0.984509468, -0.0321052969, 0.243208498, -0.0109513998, 0.969912171) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 744 | CFrame.new(-0.545306504, -1.37044179, -0.679420352, 0.996202111, 0.0754783303, 0.0434113704, -0.0434117466, 0.862729907, -0.503797948, -0.0754781216, 0.49999994, 0.862729967) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 745 | }, .6, false) | |
| 746 | FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-30), math.rad(-20), math.rad(0)), 0.3) | |
| 747 | end | |
| 748 | for i = 0, 1, 0.15 do | |
| 749 | swait() | |
| 750 | RootPart.Velocity = RootPart.CFrame.lookVector * -100 | |
| 751 | PlayAnimationFromTable({
| |
| 752 | CFrame.new(-0, -0.795007467, 0.0831707418, 1, 0, -0, 0, 0.76604414, -0.642788053, 0, 0.642788053, 0.76604414) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 753 | CFrame.new(0, 1.49999774, 1.20103359e-005, 1, 0, -0, 0, 0.965925634, 0.258819878, -0, -0.258819878, 0.965925634) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 754 | CFrame.new(1.70605683, 1.21151328, -0.185158521, 0.893217862, -0.29338178, -0.340718448, -0.340719074, -0.936116338, -0.0871595442, -0.293381065, 0.193941653, -0.936116695) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 755 | CFrame.new(-1.69524968, 1.05172348, -0.252849877, 0.812758088, 0.493294626, 0.309975445, 0.582562625, -0.694268882, -0.422624737, 0.00672781467, 0.524071693, -0.851647615) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 756 | CFrame.new(0.689150453, -1.88461804, -0.0157705098, 0.954536736, -0.174989104, -0.241326213, 0.172367141, 0.984509468, -0.0321044922, 0.243205875, -0.0109517872, 0.969912887) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 757 | CFrame.new(-0.536899447, -1.34506011, -0.583059072, 0.99620223, 0.0226762109, 0.0840658173, -0.043412663, 0.966281295, 0.253803402, -0.0754759163, -0.256489068, 0.963595748) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 758 | }, .2, false) | |
| 759 | FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-50), math.rad(0)), 0.3) | |
| 760 | end | |
| 761 | for i = 0, 1, 0.05 do | |
| 762 | swait() | |
| 763 | RootPart.Velocity = RootPart.CFrame.lookVector * -50 | |
| 764 | PlayAnimationFromTable({
| |
| 765 | CFrame.new(-0, -2.09708667, 0.108620644, 1, 0, -0, 0, 0.573575675, -0.819152594, 0, 0.819152594, 0.573575675) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 766 | CFrame.new(0, 1.53697455, -0.422635257, 1, 0, -0, 0, 0.766043842, 0.64278841, -0, -0.64278841, 0.766043842) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 767 | CFrame.new(1.57810855, 0.650130272, 0.33058399, 0.930655897, -0.284022599, -0.230674848, 0.352510452, 0.527023435, 0.773293555, -0.0980618149, -0.800985396, 0.590598404) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 768 | CFrame.new(-1.38994181, 0.87733829, 0.667137444, 0.963715255, 0.08906921, 0.251633942, -0.25866431, 0.0788001418, 0.962747812, 0.0659223944, -0.992903471, 0.0989798903) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 769 | CFrame.new(0.774198592, -1.52057803, -0.607582211, 0.954536974, -0.272207022, -0.121501081, 0.172365844, 0.83655864, -0.520057499, 0.243206039, 0.475471497, 0.845445395) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 770 | CFrame.new(-0.530096769, -1.05517173, -0.660005629, 0.99620223, 0.0226761587, 0.0840661526, -0.0434127897, 0.966280818, 0.253804684, -0.0754762068, -0.256490231, 0.96359539) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 771 | }, .3, false) | |
| 772 | FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-60), math.rad(0)), 0.3) | |
| 773 | end | |
| 774 | for i = 0, 1, 0.13 do | |
| 775 | swait() | |
| 776 | PlayAnimationFromTable({
| |
| 777 | CFrame.new(-0, -1.01349139, -0.251608461, 1, 0, 0, 0, 0.707105339, 0.707108378, 0, -0.707108378, 0.707105339) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 778 | CFrame.new(0.0127754211, 1.44207788, 0.0749337673, 1, 0, 0, 0, 0.939691544, -0.342023343, 0, 0.342023343, 0.939691544) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 779 | CFrame.new(1.62296665, 0.191783041, -0.192457974, 0.930656254, -0.329096794, 0.159920022, 0.352511466, 0.923570275, -0.150843769, -0.098055169, 0.196757287, 0.975536823) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 780 | CFrame.new(-0.870643735, 0.71258086, -0.942903101, 0.18127799, -0.372358024, -0.910213113, -0.781424284, 0.507405519, -0.363202393, 0.597088516, 0.777103186, -0.19898814) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 781 | CFrame.new(0.214147568, -1.73508716, -0.0895051956, 0.924306214, 0.282332808, -0.256800473, -0.113861978, 0.846218646, 0.520528436, 0.364271581, -0.451887846, 0.814311981) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 782 | CFrame.new(-0.535767198, -0.599929333, -0.996632636, 0.996202111, 0.0754788443, 0.0434101112, -0.0434126705, 0.862728953, -0.503799856, -0.0754773915, 0.500001788, 0.862729192) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 783 | }, .3, false) | |
| 784 | end | |
| 785 | attack = false | |
| 786 | end | |
| 787 | ||
| 788 | --[[Attacks]]-- | |
| 789 | ||
| 790 | mouse.Button1Down:connect(function() | |
| 791 | if attack == false and attacktype == 1 then | |
| 792 | attackone() | |
| 793 | end | |
| 794 | end) | |
| 795 | ||
| 796 | mouse.KeyDown:connect(function(k) | |
| 797 | k = k:lower() | |
| 798 | if attack == false and k == '' then | |
| 799 | ||
| 800 | end | |
| 801 | end) | |
| 802 | ||
| 803 | while true do | |
| 804 | swait() | |
| 805 | for i, v in pairs(Character:GetChildren()) do | |
| 806 | if v:IsA("Part") then
| |
| 807 | v.Material = "SmoothPlastic" | |
| 808 | elseif v:IsA("Accessory") then
| |
| 809 | v:WaitForChild("Handle").Material = "SmoothPlastic"
| |
| 810 | end | |
| 811 | end | |
| 812 | Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude | |
| 813 | velocity = RootPart.Velocity.y | |
| 814 | sine = sine + change | |
| 815 | local hit, pos = rayCast(RootPart.Position, (CFrame.new(RootPart.Position, RootPart.Position - Vector3.new(0, 1, 0))).lookVector, 4, Character) | |
| 816 | if equipped == true or equipped == false then | |
| 817 | if RootPart.Velocity.y > 1 and hit == nil then | |
| 818 | Anim = "Jump" | |
| 819 | if attack == false then | |
| 820 | PlayAnimationFromTable({
| |
| 821 | CFrame.new(-0, -0, -0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 822 | CFrame.new(0, 1.49221826, -0.044082582, 1, 0, 0, 0, 0.984807849, 0.173647985, 0, -0.173647985, 0.984807849) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 823 | CFrame.new(1.66304386, 0.182627335, 0.00782334805, 0.883022726, -0.392632574, 0.257119894, 0.321392894, 0.905103981, 0.2783764, -0.342019886, -0.163176134, 0.925416708) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 824 | CFrame.new(-1.66570556, 0.224230319, 0.110721856, 0.903736115, 0.408218145, -0.128915116, -0.34750703, 0.875426054, 0.33595863, 0.25000003, -0.258819014, 0.933012724) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 825 | CFrame.new(0.499999166, -1.99999452, 4.76837158e-007, 0.984807849, -5.94328526e-007, -0.173648044, 0.0449439958, 0.965925872, 0.254886925, 0.167730987, -0.258819073, 0.951251388) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 826 | CFrame.new(-0.499999404, -1.51703107, -0.129407585, 0.965925753, 6.6929374e-007, 0.258819193, -0.0669879839, 0.965925813, 0.24999994, -0.24999994, -0.258819163, 0.933012724) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 827 | }, .3, false) | |
| 828 | end | |
| 829 | elseif RootPart.Velocity.y < -1 and hit == nil then | |
| 830 | Anim = "Fall" | |
| 831 | if attack == false then | |
| 832 | PlayAnimationFromTable({
| |
| 833 | CFrame.new(-0, -0, -0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 834 | CFrame.new(0, 1.49221873, -0.0440826714, 1, 0, 0, 0, 0.984807849, 0.173647985, 0, -0.173647985, 0.984807849) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 835 | CFrame.new(1.76076102, 0.406842887, 0.0212866664, 0.695482016, -0.670965135, 0.257119834, 0.611573994, 0.74059701, 0.278376371, -0.377202988, -0.0363579579, 0.925416648) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 836 | CFrame.new(-1.68029141, 0.390803367, 0.155905366, 0.70961535, 0.692695498, -0.128914997, -0.625963271, 0.703777075, 0.335958213, 0.323444158, -0.157705069, 0.933012843) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 837 | CFrame.new(0.693307817, -1.96826017, -0.0605875254, 0.986561239, -0.127662987, -0.101976946, 0.137943029, 0.985269904, 0.101069227, 0.0875720233, -0.113777988, 0.989639223) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 838 | CFrame.new(-0.526552737, -1.81498528, -0.152177691, 0.965925574, 0.0449441113, 0.254888207, -0.066988036, 0.994663239, 0.0784704387, -0.250001162, -0.0928710476, 0.963781357) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 839 | }, .3, false) | |
| 840 | end | |
| 841 | elseif Torsovelocity < 1 and hit ~= nil then | |
| 842 | Anim = "Idle" | |
| 843 | if attack == false then | |
| 844 | change = 1 | |
| 845 | PlayAnimationFromTable({
| |
| 846 | CFrame.new(1.22602091e-006, -0.219458103, 1.46111324e-006, 0.76604414, 0, 0.642788053, 0, 1, 0, -0.642788053, 0, 0.76604414) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 847 | CFrame.new(0, 1.49999201, 0, 0.707106233, 0, -0.707107306, 0, 1, 0, 0.707107306, 0, 0.707106233) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 848 | CFrame.new(0.571566343, -0.0739164352, -0.639066696, 0.939692855, 0.340718329, -0.0298085809, -0.241844058, 0.600305915, -0.762328327, -0.241844922, 0.723563433, 0.646503866) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 849 | CFrame.new(-0.628383756, -0.12163578, -0.696761668, 0.939692736, -0.342020065, -5.06639481e-007, 0.196173996, 0.538984895, -0.819152653, 0.280166954, 0.769751549, 0.573575616) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 850 | CFrame.new(0.624118924, -1.79798961, 0.0678238794, 0.995454907, -0.0383867361, -0.0871553123, 0.0385330059, 0.999257326, -4.09960694e-006, 0.0870907605, -0.00335427374, 0.996194839) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 851 | CFrame.new(-0.53866595, -1.82180798, 0.00821807235, 0.977763176, 0.0281341001, 0.207816422, -0.0287620034, 0.999586344, -1.4934686e-007, -0.207730502, -0.00597707182, 0.978167892) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 852 | }, .3, false) | |
| 853 | FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-20), math.rad(0)), 0.3) | |
| 854 | end | |
| 855 | elseif Torsovelocity > 2 and hit ~= nil then | |
| 856 | Anim = "Walk" | |
| 857 | if attack == false then | |
| 858 | change = 3 | |
| 859 | PlayAnimationFromTable({
| |
| 860 | CFrame.new(0, -0.0240751095, -0.146390602, 1, 0, 0, 0, 0.965925872, 0.258818984, 0, -0.258818984, 0.965925872) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 861 | CFrame.new(0, 1.49999237, -1.81794167e-006, 1, 0, 0, 0, 0.984807789, -0.173647881, 0, 0.173647881, 0.984807789) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 862 | CFrame.new(0.172261134, 0.427689523, -1.09730911, 0.644483984, 0.748984814, -0.153825179, 0.413525045, -0.510645986, -0.753815472, -0.643146515, 0.422211438, -0.638827145) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 863 | CFrame.new(-1.1922102, 0.363029838, -0.448653877, 0.935289383, -0.110854559, -0.33607316, -0.341521561, -0.531564534, -0.775114357, -0.0927196145, 0.839732468, -0.535025835) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), | |
| 864 | CFrame.new(.5, -1.85 - 0.5 * math.cos(sine / 8) / 2, 0 + 1.8 * math.sin(sine / 8) / 2) * angles(math.rad(-50 * math.sin(sine / 8)), math.rad(0), math.rad(0)), | |
| 865 | CFrame.new(-.5, -1.85 + 0.5 * math.cos(sine / 8) / 2, 0 - 1.8 * math.sin(sine / 8) / 2) * angles(math.rad(50 * math.sin(sine / 8)), math.rad(0), math.rad(0)), | |
| 866 | }, .3, false) | |
| 867 | FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-30), math.rad(0)), 0.3) | |
| 868 | end | |
| 869 | end | |
| 870 | end | |
| 871 | if 0 < #Effects then | |
| 872 | for e = 1, #Effects do | |
| 873 | if Effects[e] ~= nil then | |
| 874 | local Thing = Effects[e] | |
| 875 | if Thing ~= nil then | |
| 876 | local Part = Thing[1] | |
| 877 | local Mode = Thing[2] | |
| 878 | local Delay = Thing[3] | |
| 879 | local IncX = Thing[4] | |
| 880 | local IncY = Thing[5] | |
| 881 | local IncZ = Thing[6] | |
| 882 | if Thing[2] == "Shoot" then | |
| 883 | local Look = Thing[1] | |
| 884 | local hit, pos = rayCast(Thing[4], Look, 15, Character) | |
| 885 | local mag = (Thing[4] - pos).magnitude | |
| 886 | Thing[9] = Thing[9] + 0.5 | |
| 887 | Thing[5] = Thing[5] + 0.2 | |
| 888 | Thing[6] = Thing[6] + 0.2 | |
| 889 | Effects["Cylinder"].Create(BrickColor.new("New Yeller"), CFrame.new((Thing[4] + pos) / 2, pos) * angles(1.57, 0, 0), Thing[9], mag * 5, Thing[9], -0.2, 0, -0.2, 0.1)
| |
| 890 | Thing[4] = Thing[4] + Look * 15 | |
| 891 | Thing[3] = Thing[3] - 1 | |
| 892 | if hit ~= nil then | |
| 893 | Thing[3] = 0 | |
| 894 | ref = CFuncs["Part"].Create(workspace, "Neon", 0, 1, BrickColor.new("Really red"), "Reference", Vector3.new())
| |
| 895 | ref.Anchored = true | |
| 896 | ref.CFrame = CFrame.new(pos) | |
| 897 | Effects["Sphere"].Create(BrickColor.new("New Yeller"), CFrame.new(pos), 5, 5, 5, 1, 1, 1, 0.07)
| |
| 898 | CFuncs["Sound"].Create("rbxassetid://315748949", ref, 1, 1.1)
| |
| 899 | game:GetService("Debris"):AddItem(ref, 1)
| |
| 900 | end | |
| 901 | if Thing[3] <= 0 then | |
| 902 | table.remove(Effects, e) | |
| 903 | end | |
| 904 | end | |
| 905 | do | |
| 906 | if Thing[2] == "Shoot2" then | |
| 907 | local Look = Thing[1] | |
| 908 | local hit, pos = rayCast(Thing[4], Look, 3, Character) | |
| 909 | local mag = (Thing[4] - pos).magnitude | |
| 910 | Thing[9] = Thing[9] + 0.5 | |
| 911 | Thing[5] = Thing[5] + 0.2 | |
| 912 | Thing[6] = Thing[6] + 0.2 | |
| 913 | Effects["Sphere"].Create(BrickColor.new("New Yeller"), CFrame.new((Thing[4] + pos) / 2, pos), 25, 25, 25, -5, -5, -5, 0.2)
| |
| 914 | Thing[4] = Thing[4] + Look * 3 | |
| 915 | Thing[3] = Thing[3] + 5 | |
| 916 | if hit ~= nil then | |
| 917 | Thing[3] = 0 | |
| 918 | ref = CFuncs["Part"].Create(workspace, "Neon", 0, 1, BrickColor.new("Really red"), "Reference", Vector3.new())
| |
| 919 | ref.Anchored = true | |
| 920 | ref.CFrame = CFrame.new(pos) | |
| 921 | Effects["Sphere"].Create(BrickColor.new("New Yeller"), CFrame.new(pos), 25, 25, 25, 5, 5, 5, 0.01)
| |
| 922 | Effects["Sphere"].Create(BrickColor.new("New Yeller"), CFrame.new(pos), 10, 10, 10, 15, 15, 15, 0.01)
| |
| 923 | Effects["Block"].Create(BrickColor.new("New Yeller"), CFrame.new(pos), 10, 10, 10, 15, 15, 15, 0.01, 1)
| |
| 924 | Effects["Wave"].Create(BrickColor.new("New Yeller"), CFrame.new(pos), 2, 2, 2, 3, 3, 3, 0.01)
| |
| 925 | CFuncs["Sound"].Create("rbxassetid://203691837", ref, 1, .3)
| |
| 926 | CFuncs["Sound"].Create("rbxassetid://203691885", ref, 1, .9)
| |
| 927 | CFuncs["Sound"].Create("rbxassetid://184718741", ref, 1, .9)
| |
| 928 | local e = Instance.new("Explosion", ref)
| |
| 929 | e.Position = ref.Position | |
| 930 | e.BlastRadius = 400 | |
| 931 | e.DestroyJointRadiusPercent = 20 | |
| 932 | e.Visible = false | |
| 933 | e.ExplosionType = "CratersAndDebris" | |
| 934 | game:GetService("Debris"):AddItem(ref, 10)
| |
| 935 | end | |
| 936 | if Thing[3] <= 0 then | |
| 937 | table.remove(Effects, e) | |
| 938 | end | |
| 939 | end | |
| 940 | do | |
| 941 | do | |
| 942 | if Thing[2] ~= "Shoot" and Thing[2] ~= "DecreaseStat" and Thing[2] ~= "showDamage" and Thing[2] ~= "Shoot2" then | |
| 943 | if Thing[1].Transparency <= 1 then | |
| 944 | if Thing[2] == "Block1" then | |
| 945 | Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)) | |
| 946 | Mesh = Thing[7] | |
| 947 | Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6]) | |
| 948 | Thing[1].Transparency = Thing[1].Transparency + Thing[3] | |
| 949 | else | |
| 950 | if Thing[2] == "Block2" then | |
| 951 | Thing[1].CFrame = Thing[1].CFrame | |
| 952 | Mesh = Thing[7] | |
| 953 | Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6]) | |
| 954 | Thing[1].Transparency = Thing[1].Transparency + Thing[3] | |
| 955 | else | |
| 956 | if Thing[2] == "Block3" then | |
| 957 | Thing[8].C0 = CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)) * Thing[9] | |
| 958 | Mesh = Thing[7] | |
| 959 | Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6]) | |
| 960 | Thing[1].Transparency = Thing[1].Transparency + Thing[3] | |
| 961 | else | |
| 962 | if Thing[2] == "Cylinder" then | |
| 963 | Mesh = Thing[7] | |
| 964 | Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6]) | |
| 965 | Thing[1].Transparency = Thing[1].Transparency + Thing[3] | |
| 966 | else | |
| 967 | if Thing[2] == "Cylinder2" then | |
| 968 | Thing[1].CFrame = Thing[1].CFrame * CFrame.new(0, Thing[8], 0) | |
| 969 | Mesh = Thing[7] | |
| 970 | Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6]) | |
| 971 | Thing[1].Transparency = Thing[1].Transparency + Thing[3] | |
| 972 | else | |
| 973 | if Thing[2] == "Blood" then | |
| 974 | Mesh = Thing[7] | |
| 975 | Thing[1].CFrame = Thing[1].CFrame * CFrame.new(0, 0.5, 0) | |
| 976 | Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6]) | |
| 977 | Thing[1].Transparency = Thing[1].Transparency + Thing[3] | |
| 978 | else | |
| 979 | if Thing[2] == "Elec" then | |
| 980 | Mesh = Thing[10] | |
| 981 | Mesh.Scale = Mesh.Scale + Vector3.new(Thing[7], Thing[8], Thing[9]) | |
| 982 | Thing[1].Transparency = Thing[1].Transparency + Thing[3] | |
| 983 | else | |
| 984 | if Thing[2] == "Disappear" then | |
| 985 | Thing[1].Transparency = Thing[1].Transparency + Thing[3] | |
| 986 | end | |
| 987 | end | |
| 988 | end | |
| 989 | end | |
| 990 | end | |
| 991 | end | |
| 992 | end | |
| 993 | end | |
| 994 | else | |
| 995 | Part.Parent = nil | |
| 996 | table.remove(Effects, e) | |
| 997 | end | |
| 998 | end | |
| 999 | end | |
| 1000 | end | |
| 1001 | end | |
| 1002 | end | |
| 1003 | end | |
| 1004 | end | |
| 1005 | end | |
| 1006 | end |