SHOW:
|
|
- or go back to the newest paste.
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 | do | |
6 | print("FE Compatibility code V2 by Mokiros") | |
7 | local RealPlayer = RealPlayer | |
8 | script.Parent = RealPlayer.Character | |
9 | ||
10 | --Fake event to make stuff like Mouse.KeyDown work | |
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 | Connect = function(this,f) | |
17 | local i = tostring(math.random(0,10000)) | |
18 | while this.Functions[i] do | |
19 | i = tostring(math.random(0,10000)) | |
20 | end | |
21 | this.Functions[i] = f | |
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 FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()} | |
32 | - | sick.SoundId = "rbxassetid://397874147" |
32 | + | FakeMouse.keyUp = FakeMouse.KeyUp |
33 | FakeMouse.keyDown = FakeMouse.KeyDown | |
34 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
35 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
36 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
37 | - | local EFFECT = Instance.new("DistortionSoundEffect",sick) |
37 | + | end} |
38 | - | EFFECT.Level = 0 |
38 | + | --Merged 2 functions into one by checking amount of arguments |
39 | CAS.UnbindAction = CAS.BindAction | |
40 | ||
41 | --This function will trigger the events that have been :Connect()'ed | |
42 | local function TriggerEvent(self,ev,...) | |
43 | for _,f in pairs(self[ev].Functions) do | |
44 | f(...) | |
45 | end | |
46 | end | |
47 | FakeMouse.TriggerEvent = TriggerEvent | |
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 | if not io.isMouse then | |
58 | local b = io.UserInputState == Enum.UserInputState.Begin | |
59 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
60 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
61 | end | |
62 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
63 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
64 | end | |
65 | for _,t in pairs(CAS.Actions) do | |
66 | for _,k in pairs(t.Keys) do | |
67 | if k==io.KeyCode then | |
68 | t.Function(t.Name,io.UserInputState,io) | |
69 | end | |
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 | end | |
75 | end) | |
76 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event") | |
77 | local Mouse = owner:GetMouse() | |
78 | local UIS = game:GetService("UserInputService") | |
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 | |
84 | UIS.InputBegan:Connect(input) | |
85 | UIS.InputEnded:Connect(input) | |
86 | ||
87 | local h,t | |
88 | --Give the server mouse data every second frame, but only if the values changed | |
89 | --If player is not moving their mouse, client won't fire events | |
90 | local HB = game:GetService("RunService").Heartbeat | |
91 | while true do | |
92 | if h~=Mouse.Hit or t~=Mouse.Target then | |
93 | h,t=Mouse.Hit,Mouse.Target | |
94 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
95 | end | |
96 | --Wait 2 frames | |
97 | for i=1,2 do | |
98 | HB:Wait() | |
99 | end | |
100 | end]==],script) | |
101 | ||
102 | ----Sandboxed game object that allows the usage of client-side methods and services | |
103 | --Real game object | |
104 | local RealGame = game | |
105 | ||
106 | --Metatable for fake service | |
107 | local FakeService_Metatable = { | |
108 | __index = function(self,k) | |
109 | local s = rawget(self,"_RealService") | |
110 | if s then | |
111 | return typeof(s[k])=="function" | |
112 | and function(_,...)return s[k](s,...)end or s[k] | |
113 | end | |
114 | end, | |
115 | __newindex = function(self,k,v) | |
116 | local s = rawget(self,"_RealService") | |
117 | if s then s[k]=v end | |
118 | end | |
119 | } | |
120 | local function FakeService(t,RealService) | |
121 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
122 | return setmetatable(t,FakeService_Metatable) | |
123 | end | |
124 | ||
125 | --Fake game object | |
126 | local FakeGame = { | |
127 | GetService = function(self,s) | |
128 | return rawget(self,s) or RealGame:GetService(s) | |
129 | end, | |
130 | Players = FakeService({ | |
131 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player) | |
132 | },"Players"), | |
133 | UserInputService = FakeService(UIS,"UserInputService"), | |
134 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
135 | RunService = FakeService({ | |
136 | _btrs = {}, | |
137 | RenderStepped = RealGame:GetService("RunService").Heartbeat, | |
138 | BindToRenderStep = function(self,name,_,fun) | |
139 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
140 | end, | |
141 | UnbindFromRenderStep = function(self,name) | |
142 | self._btrs[name]:Disconnect() | |
143 | end, | |
144 | },"RunService") | |
145 | } | |
146 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
147 | FakeGame.service = FakeGame.GetService | |
148 | FakeService(FakeGame,game) | |
149 | --Changing owner to fake player object to support owner:GetMouse() | |
150 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
151 | end | |
152 | ||
153 | --//====================================================\\-- | |
154 | --|| CREATED BY SHACKLUSTER | |
155 | --\\====================================================//-- | |
156 | ||
157 | ||
158 | ||
159 | wait(0.2) | |
160 | ||
161 | ||
162 | ||
163 | Player = game:GetService("Players").LocalPlayer | |
164 | PlayerGui = Player.PlayerGui | |
165 | Cam = workspace.CurrentCamera | |
166 | Backpack = Player.Backpack | |
167 | Character = Player.Character | |
168 | Humanoid = Character.Humanoid | |
169 | Mouse = Player:GetMouse() | |
170 | RootPart = Character["HumanoidRootPart"] | |
171 | Torso = Character["Torso"] | |
172 | Head = Character["Head"] | |
173 | RightArm = Character["Right Arm"] | |
174 | LeftArm = Character["Left Arm"] | |
175 | RightLeg = Character["Right Leg"] | |
176 | LeftLeg = Character["Left Leg"] | |
177 | RootJoint = RootPart["RootJoint"] | |
178 | Neck = Torso["Neck"] | |
179 | RightShoulder = Torso["Right Shoulder"] | |
180 | LeftShoulder = Torso["Left Shoulder"] | |
181 | RightHip = Torso["Right Hip"] | |
182 | LeftHip = Torso["Left Hip"] | |
183 | local sick = Instance.new("Sound",Head) | |
184 | sick.SoundId = "rbxassetid://907409748" | |
185 | sick.Looped = true | |
186 | sick.Pitch = 1 | |
187 | sick.Volume = 1 | |
188 | sick:Play() | |
189 | ||
190 | IT = Instance.new | |
191 | CF = CFrame.new | |
192 | VT = Vector3.new | |
193 | RAD = math.rad | |
194 | C3 = Color3.new | |
195 | UD2 = UDim2.new | |
196 | BRICKC = BrickColor.new | |
197 | ANGLES = CFrame.Angles | |
198 | EULER = CFrame.fromEulerAnglesXYZ | |
199 | COS = math.cos | |
200 | ACOS = math.acos | |
201 | SIN = math.sin | |
202 | ASIN = math.asin | |
203 | ABS = math.abs | |
204 | MRANDOM = math.random | |
205 | FLOOR = math.floor | |
206 | ||
207 | function CreateMesh(MESH, PARENT, MESHTYPE, MESHID, TEXTUREID, SCALE, OFFSET) | |
208 | local NEWMESH = IT(MESH) | |
209 | if MESH == "SpecialMesh" then | |
210 | NEWMESH.MeshType = MESHTYPE | |
211 | if MESHID ~= "nil" and MESHID ~= "" then | |
212 | NEWMESH.MeshId = "http://www.roblox.com/asset/?id="..MESHID | |
213 | end | |
214 | if TEXTUREID ~= "nil" and TEXTUREID ~= "" then | |
215 | NEWMESH.TextureId = "http://www.roblox.com/asset/?id="..TEXTUREID | |
216 | end | |
217 | end | |
218 | NEWMESH.Offset = OFFSET or VT(0, 0, 0) | |
219 | NEWMESH.Scale = SCALE | |
220 | NEWMESH.Parent = PARENT | |
221 | return NEWMESH | |
222 | end | |
223 | ||
224 | function CreatePart(FORMFACTOR, PARENT, MATERIAL, REFLECTANCE, TRANSPARENCY, BRICKCOLOR, NAME, SIZE, ANCHOR) | |
225 | local NEWPART = IT("Part") | |
226 | NEWPART.formFactor = FORMFACTOR | |
227 | NEWPART.Reflectance = REFLECTANCE | |
228 | NEWPART.Transparency = TRANSPARENCY | |
229 | NEWPART.CanCollide = false | |
230 | NEWPART.Locked = true | |
231 | NEWPART.Anchored = true | |
232 | if ANCHOR == false then | |
233 | NEWPART.Anchored = false | |
234 | end | |
235 | NEWPART.BrickColor = BRICKC(tostring(BRICKCOLOR)) | |
236 | NEWPART.Name = NAME | |
237 | NEWPART.Size = SIZE | |
238 | NEWPART.Position = Torso.Position | |
239 | NEWPART.Material = MATERIAL | |
240 | NEWPART:BreakJoints() | |
241 | NEWPART.Parent = PARENT | |
242 | return NEWPART | |
243 | end | |
244 | ||
245 | --//=================================\\ | |
246 | --|| CUSTOMIZATION | |
247 | --\\=================================// | |
248 | ||
249 | Player_Size = 1 --Size of the player. | |
250 | Animation_Speed = 3 | |
251 | Frame_Speed = 1 / 60 -- (1 / 30) OR (1 / 60) | |
252 | ||
253 | local Speed = 16 | |
254 | local Effects2 = {} | |
255 | ||
256 | --//=================================\\ | |
257 | --|| END OF CUSTOMIZATION | |
258 | --\\=================================// | |
259 | ||
260 | local function weldBetween(a, b) | |
261 | local weldd = Instance.new("ManualWeld") | |
262 | weldd.Part0 = a | |
263 | weldd.Part1 = b | |
264 | weldd.C0 = CFrame.new() | |
265 | weldd.C1 = b.CFrame:inverse() * a.CFrame | |
266 | weldd.Parent = a | |
267 | return weldd | |
268 | end | |
269 | ||
270 | function createaccessory(attachmentpart,mesh,texture,scale,offset,color) | |
271 | local acs = Instance.new("Part") | |
272 | acs.CanCollide = false | |
273 | acs.Anchored = false | |
274 | acs.Size = Vector3.new(0,0,0) | |
275 | acs.CFrame = attachmentpart.CFrame | |
276 | acs.Parent = Character | |
277 | acs.BrickColor = color | |
278 | local meshs = Instance.new("SpecialMesh") | |
279 | meshs.MeshId = mesh | |
280 | meshs.TextureId = texture | |
281 | meshs.Parent = acs | |
282 | meshs.Scale = scale | |
283 | meshs.Offset = offset | |
284 | weldBetween(attachmentpart,acs) | |
285 | end | |
286 | ||
287 | function createbodypart(TYPE,COLOR,PART,OFFSET,SIZE) | |
288 | if TYPE == "Gem" then | |
289 | local acs = CreatePart(3, Character, "Plastic", 0, 0, COLOR, "Part", VT(0,0,0)) | |
290 | acs.Anchored = false | |
291 | acs.CanCollide = false | |
292 | acs.CFrame = PART.CFrame | |
293 | local acs2 = CreateMesh("SpecialMesh", acs, "FileMesh", "9756362", "", SIZE, OFFSET) | |
294 | weldBetween(PART,acs) | |
295 | elseif TYPE == "Skull" then | |
296 | local acs = CreatePart(3, Character, "Plastic", 0, 0, COLOR, "Part", VT(0,0,0)) | |
297 | acs.Anchored = false | |
298 | acs.CanCollide = false | |
299 | acs.CFrame = PART.CFrame | |
300 | local acs2 = CreateMesh("SpecialMesh", acs, "FileMesh", "4770583", "", SIZE, OFFSET) | |
301 | weldBetween(PART,acs) | |
302 | elseif TYPE == "Eye" then | |
303 | local acs = CreatePart(3, Character, "Neon", 0, 0, COLOR, "Part", VT(0,0,0)) | |
304 | acs.Anchored = false | |
305 | acs.CanCollide = false | |
306 | acs.CFrame = PART.CFrame | |
307 | local acs2 = CreateMesh("SpecialMesh", acs, "Sphere", "", "", SIZE, OFFSET) | |
308 | weldBetween(PART,acs) | |
309 | end | |
310 | end | |
311 | ||
312 | --//=================================\\ | |
313 | --|| USEFUL VALUES | |
314 | --\\=================================// | |
315 | ||
316 | local ROOTC0 = CF(0, 0, 0) * ANGLES(RAD(-90), RAD(0), RAD(180)) | |
317 | local NECKC0 = CF(0, 1, 0) * ANGLES(RAD(-90), RAD(0), RAD(180)) | |
318 | local RIGHTSHOULDERC0 = CF(-0.5, 0, 0) * ANGLES(RAD(0), RAD(90), RAD(0)) | |
319 | local LEFTSHOULDERC0 = CF(0.5, 0, 0) * ANGLES(RAD(0), RAD(-90), RAD(0)) | |
320 | local CHANGEDEFENSE = 0 | |
321 | local CHANGEDAMAGE = 0 | |
322 | local CHANGEMOVEMENT = 0 | |
323 | local ANIM = "Idle" | |
324 | local ATTACK = false | |
325 | local EQUIPPED = false | |
326 | local HOLD = false | |
327 | local COMBO = 1 | |
328 | local Rooted = false | |
329 | local SINE = 0 | |
330 | local KEYHOLD = false | |
331 | local CHANGE = 2 / Animation_Speed | |
332 | local WALKINGANIM = false | |
333 | local WALK = 0 | |
334 | local VALUE1 = false | |
335 | local VALUE2 = false | |
336 | local ROBLOXIDLEANIMATION = IT("Animation") | |
337 | ROBLOXIDLEANIMATION.Name = "Roblox Idle Animation" | |
338 | ROBLOXIDLEANIMATION.AnimationId = "http://www.roblox.com/asset/?id=180435571" | |
339 | --ROBLOXIDLEANIMATION.Parent = Humanoid | |
340 | local WEAPONGUI = IT("ScreenGui", PlayerGui) | |
341 | WEAPONGUI.Name = "Weapon GUI" | |
342 | local Weapon = IT("Model") | |
343 | Weapon.Name = "Adds" | |
344 | local Effects = IT("Folder", Weapon) | |
345 | Effects.Name = "Effects" | |
346 | local ANIMATOR = Humanoid.Animator | |
347 | local ANIMATE = Character.Animate | |
348 | local HITPLAYERSOUNDS = {--[["199149137", "199149186", "199149221", "199149235", "199149269", "199149297"--]]"263032172", "263032182", "263032200", "263032221", "263032252", "263033191"} | |
349 | local HITARMORSOUNDS = {"199149321", "199149338", "199149367", "199149409", "199149452"} | |
350 | local HITWEAPONSOUNDS = {"199148971", "199149025", "199149072", "199149109", "199149119"} | |
351 | local HITBLOCKSOUNDS = {"199148933", "199148947"} | |
352 | local UNANCHOR = true | |
353 | ||
354 | local SKILLTEXTCOLOR = C3(0,0,0) | |
355 | ||
356 | --//=================================\\ | |
357 | --\\=================================// | |
358 | ||
359 | ||
360 | --//=================================\\ | |
361 | --|| SAZERENOS' ARTIFICIAL HEARTBEAT | |
362 | --\\=================================// | |
363 | ||
364 | ArtificialHB = Instance.new("BindableEvent", script) | |
365 | ArtificialHB.Name = "ArtificialHB" | |
366 | ||
367 | script:WaitForChild("ArtificialHB") | |
368 | ||
369 | frame = Frame_Speed | |
370 | tf = 0 | |
371 | allowframeloss = false | |
372 | tossremainder = false | |
373 | lastframe = tick() | |
374 | script.ArtificialHB:Fire() | |
375 | ||
376 | game:GetService("RunService").Heartbeat:connect(function(s, p) | |
377 | tf = tf + s | |
378 | if tf >= frame then | |
379 | if allowframeloss then | |
380 | script.ArtificialHB:Fire() | |
381 | lastframe = tick() | |
382 | else | |
383 | for i = 1, math.floor(tf / frame) do | |
384 | script.ArtificialHB:Fire() | |
385 | end | |
386 | lastframe = tick() | |
387 | end | |
388 | if tossremainder then | |
389 | tf = 0 | |
390 | else | |
391 | tf = tf - frame * math.floor(tf / frame) | |
392 | end | |
393 | end | |
394 | end) | |
395 | ||
396 | --//=================================\\ | |
397 | --\\=================================// | |
398 | ||
399 | ||
400 | ||
401 | ||
402 | ||
403 | --//=================================\\ | |
404 | --|| SOME FUNCTIONS | |
405 | --\\=================================// | |
406 | ||
407 | function Raycast(POSITION, DIRECTION, RANGE, IGNOREDECENDANTS) | |
408 | return workspace:FindPartOnRay(Ray.new(POSITION, DIRECTION.unit * RANGE), IGNOREDECENDANTS) | |
409 | end | |
410 | ||
411 | function PositiveAngle(NUMBER) | |
412 | if NUMBER >= 0 then | |
413 | NUMBER = 0 | |
414 | end | |
415 | return NUMBER | |
416 | end | |
417 | ||
418 | function NegativeAngle(NUMBER) | |
419 | if NUMBER <= 0 then | |
420 | NUMBER = 0 | |
421 | end | |
422 | return NUMBER | |
423 | end | |
424 | ||
425 | function Swait(NUMBER) | |
426 | if NUMBER == 0 or NUMBER == nil then | |
427 | ArtificialHB.Event:wait() | |
428 | else | |
429 | for i = 1, NUMBER do | |
430 | ArtificialHB.Event:wait() | |
431 | end | |
432 | end | |
433 | end | |
434 | ||
435 | - | local HandleMesh = CreateMesh("SpecialMesh", Gun, "FileMesh", "430345282", "430345284", VT(0.2,0.2,0.2), VT(0,0, 0)) |
435 | + | |
436 | - | local Weld = CreateWeldOrSnapOrMotor("Weld", Gun, RightArm, Gun, CF(-0.55, -1.2, 0) * ANGLES(RAD(180), RAD(-90), RAD(0)), CF(0, 0, 0)) |
436 | + | |
437 | local trace = m00 + m11 + m22 | |
438 | if trace > 0 then | |
439 | local s = math.sqrt(1 + trace) | |
440 | local recip = 0.5 / s | |
441 | return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5 | |
442 | else | |
443 | local i = 0 | |
444 | if m11 > m00 then | |
445 | i = 1 | |
446 | end | |
447 | if m22 > (i == 0 and m00 or m11) then | |
448 | i = 2 | |
449 | end | |
450 | if i == 0 then | |
451 | local s = math.sqrt(m00 - m11 - m22 + 1) | |
452 | local recip = 0.5 / s | |
453 | return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip | |
454 | elseif i == 1 then | |
455 | local s = math.sqrt(m11 - m22 - m00 + 1) | |
456 | local recip = 0.5 / s | |
457 | return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip | |
458 | elseif i == 2 then | |
459 | local s = math.sqrt(m22 - m00 - m11 + 1) | |
460 | local recip = 0.5 / s return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip | |
461 | end | |
462 | end | |
463 | end | |
464 | ||
465 | function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
466 | local xs, ys, zs = x + x, y + y, z + z | |
467 | local wx, wy, wz = w * xs, w * ys, w * zs | |
468 | local xx = x * xs | |
469 | local xy = x * ys | |
470 | local xz = x * zs | |
471 | local yy = y * ys | |
472 | local yz = y * zs | |
473 | local zz = z * zs | |
474 | 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)) | |
475 | end | |
476 | ||
477 | function QuaternionSlerp(a, b, t) | |
478 | local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4] | |
479 | local startInterp, finishInterp; | |
480 | if cosTheta >= 0.0001 then | |
481 | if (1 - cosTheta) > 0.0001 then | |
482 | local theta = ACOS(cosTheta) | |
483 | local invSinTheta = 1 / SIN(theta) | |
484 | startInterp = SIN((1 - t) * theta) * invSinTheta | |
485 | finishInterp = SIN(t * theta) * invSinTheta | |
486 | else | |
487 | startInterp = 1 - t | |
488 | finishInterp = t | |
489 | end | |
490 | else | |
491 | if (1 + cosTheta) > 0.0001 then | |
492 | local theta = ACOS(-cosTheta) | |
493 | local invSinTheta = 1 / SIN(theta) | |
494 | startInterp = SIN((t - 1) * theta) * invSinTheta | |
495 | finishInterp = SIN(t * theta) * invSinTheta | |
496 | else | |
497 | startInterp = t - 1 | |
498 | - | EFFECT.Level = 1 |
498 | + | |
499 | end | |
500 | end | |
501 | - | EFFECT.Level = 0 |
501 | + | |
502 | end | |
503 | ||
504 | function Clerp(a, b, t) | |
505 | local qa = {QuaternionFromCFrame(a)} | |
506 | local qb = {QuaternionFromCFrame(b)} | |
507 | local ax, ay, az = a.x, a.y, a.z | |
508 | local bx, by, bz = b.x, b.y, b.z | |
509 | local _t = 1 - t | |
510 | return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t)) | |
511 | end | |
512 | ||
513 | function CreateFrame(PARENT, TRANSPARENCY, BORDERSIZEPIXEL, POSITION, SIZE, COLOR, BORDERCOLOR, NAME) | |
514 | local frame = IT("Frame") | |
515 | frame.BackgroundTransparency = TRANSPARENCY | |
516 | frame.BorderSizePixel = BORDERSIZEPIXEL | |
517 | frame.Position = POSITION | |
518 | frame.Size = SIZE | |
519 | frame.BackgroundColor3 = COLOR | |
520 | frame.BorderColor3 = BORDERCOLOR | |
521 | frame.Name = NAME | |
522 | frame.Parent = PARENT | |
523 | return frame | |
524 | end | |
525 | ||
526 | function CreateLabel(PARENT, TEXT, TEXTCOLOR, TEXTFONTSIZE, TEXTFONT, TRANSPARENCY, BORDERSIZEPIXEL, STROKETRANSPARENCY, NAME) | |
527 | local label = IT("TextLabel") | |
528 | label.BackgroundTransparency = 1 | |
529 | label.Size = UD2(1, 0, 1, 0) | |
530 | label.Position = UD2(0, 0, 0, 0) | |
531 | label.TextColor3 = TEXTCOLOR | |
532 | label.TextStrokeTransparency = STROKETRANSPARENCY | |
533 | label.TextTransparency = TRANSPARENCY | |
534 | label.FontSize = TEXTFONTSIZE | |
535 | label.Font = TEXTFONT | |
536 | label.BorderSizePixel = BORDERSIZEPIXEL | |
537 | label.TextScaled = false | |
538 | label.Text = TEXT | |
539 | label.Name = NAME | |
540 | label.Parent = PARENT | |
541 | return label | |
542 | end | |
543 | ||
544 | function NoOutlines(PART) | |
545 | PART.TopSurface, PART.BottomSurface, PART.LeftSurface, PART.RightSurface, PART.FrontSurface, PART.BackSurface = 10, 10, 10, 10, 10, 10 | |
546 | end | |
547 | ||
548 | ||
549 | function CreateWeldOrSnapOrMotor(TYPE, PARENT, PART0, PART1, C0, C1) | |
550 | local NEWWELD = IT(TYPE) | |
551 | NEWWELD.Part0 = PART0 | |
552 | NEWWELD.Part1 = PART1 | |
553 | NEWWELD.C0 = C0 | |
554 | NEWWELD.C1 = C1 | |
555 | NEWWELD.Parent = PARENT | |
556 | return NEWWELD | |
557 | end | |
558 | ||
559 | function CreateSound(ID, PARENT, VOLUME, PITCH) | |
560 | local NEWSOUND = nil | |
561 | coroutine.resume(coroutine.create(function() | |
562 | NEWSOUND = IT("Sound", PARENT) | |
563 | NEWSOUND.Volume = VOLUME | |
564 | NEWSOUND.Pitch = PITCH | |
565 | NEWSOUND.SoundId = "http://www.roblox.com/asset/?id="..ID | |
566 | Swait() | |
567 | NEWSOUND:play() | |
568 | game:GetService("Debris"):AddItem(NEWSOUND, 10) | |
569 | end)) | |
570 | return NEWSOUND | |
571 | end | |
572 | ||
573 | function CFrameFromTopBack(at, top, back) | |
574 | local right = top:Cross(back) | |
575 | return CF(at.x, at.y, at.z, right.x, top.x, back.x, right.y, top.y, back.y, right.z, top.z, back.z) | |
576 | end | |
577 | ||
578 | Debris = game:GetService("Debris") | |
579 | ||
580 | --//=================================\\ | |
581 | --|| WEAPON CREATION | |
582 | --\\=================================// | |
583 | ||
584 | local Gun = CreatePart(3, Weapon, "SmoothPlastic", 0, 0, "Really black", "Handle", VT(0, 0, 0),false) | |
585 | local HandleMesh = CreateMesh("SpecialMesh", Gun, "FileMesh", "12718115", "12718102", VT(2, 2, 2), VT(0,0, 0)) | |
586 | local Weld = CreateWeldOrSnapOrMotor("Weld", Gun, RightArm, Gun, CF(-0.55, -1.2, 0) * ANGLES(RAD(0), RAD(0), RAD(180)), CF(0, 0, 0)) | |
587 | ||
588 | for _, c in pairs(Weapon:GetChildren()) do | |
589 | if c.ClassName == "Part" then | |
590 | c.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0) | |
591 | end | |
592 | end | |
593 | ||
594 | Weapon.Parent = Character | |
595 | ||
596 | Humanoid.Died:connect(function() | |
597 | ATTACK = true | |
598 | end) | |
599 | ||
600 | local SKILL1FRAME = CreateFrame(WEAPONGUI, 0.5, 2, UD2(0.365, 0, 0.90, 0), UD2(0.26, 0, 0.07, 0), C3(0,0,0), C3(0, 0, 0), "Skill 1 Frame") | |
601 | ||
602 | local SKILL1TEXT = CreateLabel(SKILL1FRAME, "[Z] Pizza launcher", SKILLTEXTCOLOR, 6, "Legacy", 0, 2, 1, "Text 1") | |
603 | ||
604 | --//=================================\\ | |
605 | --|| ATTACK FUNCTIONS AND STUFF | |
606 | --\\=================================// | |
607 | ||
608 | function PizzaLauncher() | |
609 | local PIZZA = CreatePart(3, Effects, "SmoothPlastic", 0, 0, "Really black", "Handle", VT(1,1,1),false) | |
610 | PIZZA.CFrame = CF(RootPart.Position,Mouse.Hit.p)*ANGLES(RAD(0),RAD(-90),RAD(0)) | |
611 | local bv = Instance.new("BodyVelocity") | |
612 | bv.maxForce = Vector3.new(1e9, 1e9, 1e9) | |
613 | bv.velocity = CF(PIZZA.Position,Mouse.Hit.p).lookVector*200 | |
614 | bv.Parent = PIZZA | |
615 | bv.Name = "MOVE" | |
616 | CreateSound("1058021195", PIZZA, 10, MRANDOM(8,10)/10) | |
617 | CreateMesh("SpecialMesh", PIZZA, "FileMesh", "22589477", "22589467", VT(1,1,1), VT(0,0, 0)) | |
618 | local HIT = PIZZA.Touched:Connect(function(hit) | |
619 | if hit.Parent ~= Character and hit.Parent ~= Weapon then | |
620 | hit.Parent:BreakJoints() | |
621 | end | |
622 | end) | |
623 | Debris:AddItem(PIZZA,5) | |
624 | end | |
625 | ||
626 | --//=================================\\ | |
627 | --|| ASSIGN THINGS TO KEYS | |
628 | --\\=================================// | |
629 | ||
630 | function MouseDown(Mouse) | |
631 | if ATTACK == false then | |
632 | end | |
633 | end | |
634 | ||
635 | function MouseUp(Mouse) | |
636 | HOLD = false | |
637 | end | |
638 | ||
639 | function KeyDown(Key) | |
640 | KEYHOLD = true | |
641 | if Key == "z" and ATTACK == false then | |
642 | PizzaLauncher() | |
643 | end | |
644 | ||
645 | if Key == "x" and ATTACK == false then | |
646 | if sick.Volume == 1 then | |
647 | sick.Volume = 10 | |
648 | elseif sick.Volume == 10 then | |
649 | sick.Volume = 1 | |
650 | end | |
651 | end | |
652 | end | |
653 | ||
654 | function KeyUp(Key) | |
655 | KEYHOLD = false | |
656 | end | |
657 | ||
658 | Mouse.Button1Down:connect(function(NEWKEY) | |
659 | MouseDown(NEWKEY) | |
660 | end) | |
661 | Mouse.Button1Up:connect(function(NEWKEY) | |
662 | MouseUp(NEWKEY) | |
663 | end) | |
664 | Mouse.KeyDown:connect(function(NEWKEY) | |
665 | KeyDown(NEWKEY) | |
666 | end) | |
667 | Mouse.KeyUp:connect(function(NEWKEY) | |
668 | KeyUp(NEWKEY) | |
669 | end) | |
670 | ||
671 | --//=================================\\ | |
672 | --\\=================================// | |
673 | ||
674 | ||
675 | function unanchor() | |
676 | if UNANCHOR == true then | |
677 | g = Character:GetChildren() | |
678 | for i = 1, #g do | |
679 | if g[i].ClassName == "Part" then | |
680 | g[i].Anchored = false | |
681 | end | |
682 | end | |
683 | end | |
684 | end | |
685 | ||
686 | ||
687 | --//=================================\\ | |
688 | --|| WRAP THE WHOLE SCRIPT UP | |
689 | --\\=================================// | |
690 | ||
691 | Humanoid.Changed:connect(function(Jump) | |
692 | if Jump == "Jump" and (Disable_Jump == true) then | |
693 | Humanoid.Jump = false | |
694 | end | |
695 | end) | |
696 | ||
697 | Speed = 100 | |
698 | ||
699 | while true do | |
700 | Swait() | |
701 | ANIMATE.Parent = nil | |
702 | local IDLEANIMATION = Humanoid:LoadAnimation(ROBLOXIDLEANIMATION) | |
703 | IDLEANIMATION:Play() | |
704 | SINE = SINE + CHANGE | |
705 | local TORSOVELOCITY = (RootPart.Velocity * VT(1, 0, 1)).magnitude | |
706 | local TORSOVERTICALVELOCITY = RootPart.Velocity.y | |
707 | local LV = Torso.CFrame:pointToObjectSpace(Torso.Velocity - Torso.Position) | |
708 | local HITFLOOR = Raycast(RootPart.Position, (CF(RootPart.Position, RootPart.Position + VT(0, -1, 0))).lookVector, 4 * Player_Size, Character) | |
709 | local WALKSPEEDVALUE = 6 / (Humanoid.WalkSpeed / 16) | |
710 | ANIM = "Idle" | |
711 | if ATTACK == false then | |
712 | RootJoint.C0 = Clerp(RootJoint.C0,ROOTC0 * CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), 1) | |
713 | Neck.C0 = Clerp(Neck.C0, NECKC0 * CF(0, 0, 0) * ANGLES(RAD(MRANDOM(-360,360)), RAD(MRANDOM(-360,360)), RAD(MRANDOM(-360,360))), 1) | |
714 | RightShoulder.C0 = Clerp(RightShoulder.C0, CF(1.5, 0.15, 0) * ANGLES(RAD(180), RAD(0), RAD(0)) * RIGHTSHOULDERC0, 1) | |
715 | LeftShoulder.C0 = Clerp(LeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(MRANDOM(-360,360)), RAD(MRANDOM(-360,360)), RAD(-12)) * LEFTSHOULDERC0, 1) | |
716 | RightHip.C0 = Clerp(RightHip.C0, CF(1, -1, 0) * ANGLES(RAD(0), RAD(90), RAD(0)), 1) | |
717 | LeftHip.C0 = Clerp(LeftHip.C0, CF(-1, -1, 0) * ANGLES(RAD(0), RAD(-90), RAD(0)), 1) | |
718 | end | |
719 | unanchor() | |
720 | Humanoid.MaxHealth = "inf" | |
721 | Humanoid.Health = "inf" | |
722 | if Rooted == false then | |
723 | Disable_Jump = false | |
724 | Humanoid.WalkSpeed = Speed | |
725 | elseif Rooted == true then | |
726 | Disable_Jump = true | |
727 | Humanoid.WalkSpeed = 0 | |
728 | end | |
729 | sick.Parent = Head | |
730 | end | |
731 | ||
732 | --//=================================\\ | |
733 | --\\=================================// | |
734 | ||
735 | ||
736 | ||
737 | ||
738 | ||
739 | --//====================================================\\-- | |
740 | --|| END OF SCRIPT | |
741 | --\\====================================================//-- |