SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | --https://github.com/Mokiros/roblox-FE-compatibility |
2 | - | pl = "noornabso" |
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 | 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 | end} | |
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 | 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 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 | ||
152 | pl = "silver22352" | |
153 | Player = Game:GetService("Players").LocalPlayer | |
154 | Character = Player.Character | |
155 | RightArm = Character["Right Arm"] | |
156 | RightShoulder = Character.Torso["Right Shoulder"] | |
157 | LeftArm = Character["Left Arm"] | |
158 | Torso = Character["Torso"] | |
159 | LeftLeg = Character["Left Leg"] | |
160 | RightLeg = Character["Right Leg"] | |
161 | Head = Character["Head"] | |
162 | ||
163 | Workspace.SergeantSmokey.Head.face.Texture = "http://www.roblox.com/asset/?id=17058440" | |
164 | ||
165 | function CheckI(Item,Blacklist,Specific) | |
166 | for _,v in pairs(Item:children()) do | |
167 | if not Specific then | |
168 | if v:IsA(Blacklist) or v.Name:match(Blacklist) then | |
169 | v:Destroy() | |
170 | end | |
171 | else | |
172 | if v:IsA(Blacklist) or v.Name == Blacklist then | |
173 | v:Destroy() | |
174 | end | |
175 | end | |
176 | end | |
177 | end | |
178 | ||
179 | CheckI(Character,"Hat") | |
180 | ------------------------------------- | |
181 | ||
182 | Part13 = Instance.new("Part", Character) | |
183 | Part13.TopSurface = 0 | |
184 | Part13.BottomSurface = 0 | |
185 | Part13.Transparency = 0 | |
186 | Part13.FormFactor = "Custom" | |
187 | Part13.Size = Vector3.new(1, 1, 1) | |
188 | Part13.BrickColor = BrickColor.new("Really black") | |
189 | Part13.CanCollide = false | |
190 | Weld13 = Instance.new("Weld", Part13) | |
191 | Weld13.Part0 = Part13 | |
192 | Weld13.Part1 = Head | |
193 | Weld13.C0 = CFrame.new(0, -0.8, 0) | |
194 | SHMesh = Instance.new("SpecialMesh") | |
195 | SHMesh.Parent = Part13 | |
196 | SHMesh.Scale = Vector3.new(1, 1, 1) | |
197 | SHMesh.MeshId = "http://www.roblox.com/asset/?id=1028713" | |
198 | SHMesh.TextureId = "http://www.roblox.com/asset/?id=15726328" | |
199 | ||
200 | Part135 = Instance.new("Part", Character) | |
201 | Part135.TopSurface = 0 | |
202 | Part135.BottomSurface = 0 | |
203 | Part135.Transparency = 1 | |
204 | Part135.Reflectance = 0.8 | |
205 | Part135.FormFactor = "Custom" | |
206 | Part135.Size = Vector3.new(1, 1, 1) | |
207 | Part135.BrickColor = BrickColor.new("White") | |
208 | Part135.CanCollide = false | |
209 | Weld13 = Instance.new("Weld", Part135) | |
210 | Weld13.Part0 = Part135 | |
211 | Weld13.Part1 = Head | |
212 | Weld13.C0 = CFrame.new(0, -3, 0) | |
213 | SHMesh = Instance.new("SpecialMesh") | |
214 | SHMesh.Parent = Part135 | |
215 | SHMesh.MeshType = "Sphere" | |
216 | x = Instance.new("PointLight",Part135) | |
217 | x.Range = 20 | |
218 | x.Enabled = false | |
219 | ||
220 | ||
221 | Part = Instance.new("Part", Character) | |
222 | Part.TopSurface = 0 | |
223 | Part.BottomSurface = 0 | |
224 | Part.Transparency = 0 | |
225 | Part.FormFactor = "Custom" | |
226 | Part.Size = Vector3.new(1, 2, 1) | |
227 | Part.BrickColor = BrickColor.new("Really black") | |
228 | Part.CanCollide = false | |
229 | Workspace.SergeantSmokey["Right Leg"].Transparency = 1 | |
230 | Weld = Instance.new("Weld", Part) | |
231 | Weld.Part0 = Part | |
232 | Weld.Part1 = RightLeg | |
233 | Weld.C0 = CFrame.new(0, 0, 0) | |
234 | ||
235 | Part2 = Instance.new("Part", Character) | |
236 | Part2.TopSurface = 0 | |
237 | Part2.BottomSurface = 0 | |
238 | Part2.Transparency = 0 | |
239 | Part2.FormFactor = "Custom" | |
240 | Part2.Size = Vector3.new(1, 2, 1) | |
241 | Part2.BrickColor = BrickColor.new("Really black") | |
242 | Part2.CanCollide = false | |
243 | Workspace.SergeantSmokey["Left Leg"].Transparency = 1 | |
244 | Weld2 = Instance.new("Weld", Part2) | |
245 | Weld2.Part0 = Part2 | |
246 | Weld2.Part1 = LeftLeg | |
247 | Weld2.C0 = CFrame.new(0, 0, 0) | |
248 | ||
249 | Part7 = Instance.new("Part", Character) | |
250 | Part7.TopSurface = 0 | |
251 | Part7.BottomSurface = 0 | |
252 | Part7.Transparency = 0 | |
253 | Part7.FormFactor = "Custom" | |
254 | Part7.Size = Vector3.new(1, 1.7, 1) | |
255 | Part7.BrickColor = BrickColor.new("White") | |
256 | Part7.CanCollide = false | |
257 | Workspace.SergeantSmokey["Right Arm"].Transparency = 1 | |
258 | Weld7 = Instance.new("Weld", Part7) | |
259 | Weld7.Part0 = Part7 | |
260 | Weld7.Part1 = RightArm | |
261 | Weld7.C0 = CFrame.new(0, 0.2, 0) | |
262 | ||
263 | Part45 = Instance.new("Part", Character) | |
264 | Part45.TopSurface = 0 | |
265 | Part45.BottomSurface = 0 | |
266 | Part45.Transparency = 0 | |
267 | Part45.FormFactor = "Custom" | |
268 | Part45.Size = Vector3.new(1.1, 1, 1.1) | |
269 | Part45.BrickColor = BrickColor.new("Really black") | |
270 | Part45.CanCollide = false | |
271 | Weld3 = Instance.new("Weld", Part45) | |
272 | Weld3.Part0 = Part45 | |
273 | Weld3.Part1 = RightArm | |
274 | Weld3.C0 = CFrame.new(0, -0.5, 0) | |
275 | ||
276 | Part8 = Instance.new("Part", Character) | |
277 | Part8.TopSurface = 0 | |
278 | Part8.BottomSurface = 0 | |
279 | Part8.Transparency = 0 | |
280 | Part8.FormFactor = "Custom" | |
281 | Part8.Size = Vector3.new(1, 1.7, 1) | |
282 | Part8.BrickColor = BrickColor.new("White") | |
283 | Part8.CanCollide = false | |
284 | Workspace.SergeantSmokey["Left Arm"].Transparency = 1 | |
285 | Weld8 = Instance.new("Weld", Part8) | |
286 | Weld8.Part0 = Part8 | |
287 | Weld8.Part1 = LeftArm | |
288 | Weld8.C0 = CFrame.new(0, 0.2, 0) | |
289 | ||
290 | Part45 = Instance.new("Part", Character) | |
291 | Part45.TopSurface = 0 | |
292 | Part45.BottomSurface = 0 | |
293 | Part45.Transparency = 0 | |
294 | Part45.FormFactor = "Custom" | |
295 | Part45.Size = Vector3.new(1.1, 1, 1.1) | |
296 | Part45.BrickColor = BrickColor.new("Really black") | |
297 | Part45.CanCollide = false | |
298 | Weld3 = Instance.new("Weld", Part45) | |
299 | Weld3.Part0 = Part45 | |
300 | Weld3.Part1 = LeftArm | |
301 | Weld3.C0 = CFrame.new(0, -0.5, 0) | |
302 | ||
303 | Part13 = Instance.new("Part", Character) | |
304 | Part13.TopSurface = 0 | |
305 | Part13.BottomSurface = 0 | |
306 | Part13.Transparency = 0 | |
307 | Part13.FormFactor = "Custom" | |
308 | Part13.Size = Vector3.new(2, 2, 1) | |
309 | Part13.BrickColor = BrickColor.new("Really black") | |
310 | Part13.CanCollide = false | |
311 | Workspace.SergeantSmokey["Torso"].Transparency = 1 | |
312 | Weld13 = Instance.new("Weld", Part13) | |
313 | Weld13.Part0 = Part13 | |
314 | Weld13.Part1 = Torso | |
315 | Weld13.C0 = CFrame.new(0, 0, 0) | |
316 | ||
317 | Part123 = Instance.new("Part", Character) | |
318 | Part123.TopSurface = 0 | |
319 | Part123.BottomSurface = 0 | |
320 | Part123.Transparency = 0 | |
321 | Part123.FormFactor = "Custom" | |
322 | Part123.Size = Vector3.new(1, 1, 1) | |
323 | Part123.BrickColor = BrickColor.new("White") | |
324 | Part123.CanCollide = false | |
325 | Weld13 = Instance.new("Weld", Part123) | |
326 | Weld13.Part0 = Part123 | |
327 | Weld13.Part1 = Torso | |
328 | Weld13.C0 = CFrame.new(0, 0.5, -0.8) | |
329 | SHMesh = Instance.new("SpecialMesh") | |
330 | SHMesh.Parent = Part123 | |
331 | SHMesh.Scale = Vector3.new(1.5, 1.5, 1.5) | |
332 | SHMesh.MeshId = "http://www.roblox.com/asset/?id=94820260" | |
333 | SHMesh.TextureId = "http://www.roblox.com/asset/?id=94820166" | |
334 | ||
335 | sg = Instance.new("ScreenGui") | |
336 | sg.Parent = game.Players[pl].PlayerGui | |
337 | button1 = Instance.new("TextButton") | |
338 | button1.Parent = sg | |
339 | button1.Text = "Light-On" | |
340 | button1.Position = UDim2.new(0,0,0.1,0) | |
341 | button1.Size = UDim2.new(0.1,0,0.1,0) | |
342 | button1.MouseButton1Click:connect(function() | |
343 | x.Enabled = true | |
344 | Part135.Transparency = 0 | |
345 | end) | |
346 | button2 = Instance.new("TextButton") | |
347 | button2.Parent = sg | |
348 | button2.Text = "Light-Off" | |
349 | button2.Position = UDim2.new(0,0,0.2,0) | |
350 | button2.Size = UDim2.new(0.1,0,0.1,0) | |
351 | button2.MouseButton1Click:connect(function() | |
352 | x.Enabled = false | |
353 | Part135.Transparency = 1 | |
354 | end) | |
355 | button3 = Instance.new("TextButton") | |
356 | button3.Parent = sg | |
357 | button3.Text = "Slow - 10" | |
358 | button3.Position = UDim2.new(0,0,0.3,0) | |
359 | button3.Size = UDim2.new(0.1,0,0.1,0) | |
360 | button3.MouseButton1Click:connect(function() | |
361 | Workspace.SergeantSmokey.Humanoid.WalkSpeed = Workspace.SergeantSmokey.Humanoid.WalkSpeed - 10 | |
362 | end) | |
363 | button4 = Instance.new("TextButton") | |
364 | button4.Parent = sg | |
365 | button4.Text = "Fast + 10" | |
366 | button4.Position = UDim2.new(0,0,0.4,0) | |
367 | button4.Size = UDim2.new(0.1,0,0.1,0) | |
368 | button4.MouseButton1Click:connect(function() | |
369 | Workspace.SergeantSmokey.Humanoid.WalkSpeed = Workspace.SergeantSmokey.Humanoid.WalkSpeed + 10 | |
370 | end) | |
371 | ||
372 | local h = Instance.new("HopperBin") | |
373 | h.Name = "Magic" | |
374 | local p = game.Players:findFirstChild(pl) | |
375 | if (p==nil) then return end | |
376 | h.Parent = p.Backpack | |
377 | ||
378 | function fast1() | |
379 | Workspace.SergeantSmokey.Humanoid.WalkSpeed = 100 | |
380 | end | |
381 | ||
382 | function fast2() | |
383 | Workspace.SergeantSmokey.Humanoid.WalkSpeed = 20 | |
384 | end | |
385 | ||
386 | ||
387 | ||
388 | function onKey(key, mouse) | |
389 | if key then | |
390 | local key = key:lower() | |
391 | if (key=="q") then | |
392 | fast1() | |
393 | if (key=="e") then | |
394 | fast2() | |
395 | end | |
396 | end | |
397 | end | |
398 | end | |
399 | h.Selected:connect(function(mouse) | |
400 | mouse.KeyDown:connect(function(key) onKey(key, mouse) end) | |
401 | end) | |
402 | ||
403 | --[[Soul Staff Made By malfact]]-- | |
404 | ||
405 | ||
406 | ||
407 | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
408 | local player = game.Players.LocalPlayer | |
409 | local character = player.Character | |
410 | ||
411 | if (player.Backpack:FindFirstChild("Soul Staff") ~= nil) then | |
412 | player.Backpack["Soul Staff"].Parent = nil | |
413 | end | |
414 | if (character:FindFirstChild("Soul_Staff") ~= nil) then | |
415 | character.Soul_Staff.Parent = nil | |
416 | end | |
417 | ||
418 | local RightShoulder = character.Torso["Right Shoulder"] | |
419 | local ShoulderWeld = nil | |
420 | local StaffWeld = nil | |
421 | ||
422 | local debounce = false | |
423 | local debounce2 = false | |
424 | ||
425 | local mode = "hurt" | |
426 | local orbWeld = {} | |
427 | local keys = {} | |
428 | ||
429 | local thrown = false | |
430 | local hold = false | |
431 | local holdTime = 0 | |
432 | ||
433 | local tool = Instance.new("HopperBin", player.Backpack) | |
434 | tool.Name = "Soul Staff" | |
435 | tool.Parent = player.Backpack | |
436 | local model = Instance.new("Model",character) | |
437 | model.Name = "Soul_Staff" | |
438 | ||
439 | function animateArm(boolean, c0, c1) | |
440 | if (boolean) then | |
441 | if (ShoulderWeld == nil) then | |
442 | ShoulderWeld = weld(character["Torso"],character["Right Arm"],CFrame.new()) | |
443 | end | |
444 | RightShoulder.Part0 = nil | |
445 | ||
446 | ShoulderWeld.C0 = c0 | |
447 | ShoulderWeld.C1 = c1 | |
448 | else | |
449 | RightShoulder.Part0 = character.Torso | |
450 | if (ShoulderWeld ~= nil) then | |
451 | ShoulderWeld.Parent = nil | |
452 | end | |
453 | ShoulderWeld = nil | |
454 | end | |
455 | end | |
456 | ||
457 | function animateStaff(boolean, c0, c1) | |
458 | if (boolean) then | |
459 | StaffWeld.Part0 = character["Right Arm"] | |
460 | StaffWeld.Part1 = model:FindFirstChild("Handle") | |
461 | StaffWeld.C0 = c0 | |
462 | StaffWeld.C1 = c1 | |
463 | else | |
464 | StaffWeld.Part0 = character["Torso"] | |
465 | StaffWeld.Part1 = model:FindFirstChild("Handle") | |
466 | StaffWeld.C0 = CFrame.new(0,0,0.5) | |
467 | StaffWeld.C1 = CFrame.new()*CFrame.Angles(0, 0, math.pi/4) | |
468 | end | |
469 | end | |
470 | ||
471 | function weld(p0, p1, cframe) | |
472 | local w = Instance.new("ManualWeld", p0) | |
473 | w.Part0 = p0 | |
474 | w.Part1 = p1 | |
475 | w.C0 = cframe | |
476 | return w | |
477 | end | |
478 | ||
479 | function newPart(size, color, parent) | |
480 | local part = Instance.new("Part") | |
481 | part.Locked = true | |
482 | part.FormFactor = 3 | |
483 | part.Size = size | |
484 | part.BrickColor = color | |
485 | part.BottomSurface = 0 | |
486 | part.TopSurface = 0 | |
487 | part.Anchored = false | |
488 | part.CanCollide = false | |
489 | part.Parent = parent | |
490 | return part | |
491 | end | |
492 | ||
493 | function newCylMesh(parent) | |
494 | local mesh = Instance.new("CylinderMesh", parent) | |
495 | return parent | |
496 | end | |
497 | ||
498 | function newSphereMesh(parent) | |
499 | local mesh = Instance.new("SpecialMesh",parent) | |
500 | mesh.MeshType = 3 | |
501 | return parent | |
502 | end | |
503 | ||
504 | function newIdMesh(id, size, parent) | |
505 | local mesh = Instance.new("SpecialMesh",parent) | |
506 | mesh.MeshType = 5 | |
507 | mesh.Scale = size | |
508 | mesh.MeshId = "http://www.roblox.com/Asset/?id="..id | |
509 | return parent | |
510 | end | |
511 | ||
512 | function addSoul(count) | |
513 | for i = 1, count do | |
514 | local p = newSphereMesh(newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)) | |
515 | orbWeld[#orbWeld + 1] = weld(model:FindFirstChild("core"),p,CFrame.new(0,0,0)) | |
516 | end | |
517 | end | |
518 | ||
519 | function removeSoul(count) | |
520 | for i = 1, count do | |
521 | orbWeld[#orbWeld].Part1.Parent = nil | |
522 | orbWeld[#orbWeld] = nil | |
523 | end | |
524 | end | |
525 | ||
526 | function getRadius(num) | |
527 | if (num < 16) then | |
528 | return 1 | |
529 | else | |
530 | return num/16 | |
531 | end | |
532 | end | |
533 | ||
534 | local handle = newCylMesh(newPart(Vector3.new(0.2,6,0.2),BrickColor.new(1,1,1),model)) | |
535 | handle.Name = "Handle" | |
536 | ||
537 | weld(handle,newSphereMesh(newPart(Vector3.new(0.4,0.4,0.4),BrickColor.new(0,0,0),model)),CFrame.new(0,3,0)) | |
538 | weld(handle,newCylMesh(newPart(Vector3.new(0.25,0.25,0.25),BrickColor.new(0,0,0),model)),CFrame.new(0,2.75,0)) | |
539 | weld(handle,newIdMesh("3270017",Vector3.new(0.25,0.25,0.5),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(1,1,1),model)),CFrame.new(0,2.85,0)*CFrame.Angles(math.pi/2,0,0)) | |
540 | weld(handle,newIdMesh("3270017",Vector3.new(0.22,0.22,0.5),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(1,1,1),model)),CFrame.new(0,2.6,0)*CFrame.Angles(math.pi/2,0,0)) | |
541 | weld(handle,newSphereMesh(newPart(Vector3.new(0.4,0.4,0.4),BrickColor.new(0,0,0),model)),CFrame.new(0,-3,0)) | |
542 | weld(handle,newCylMesh(newPart(Vector3.new(0.25,0.25,0.25),BrickColor.new(0,0,0),model)),CFrame.new(0,-2.75,0)) | |
543 | weld(handle,newIdMesh("3270017",Vector3.new(0.25,0.25,0.5),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(1,1,1),model)),CFrame.new(0,-2.85,0)*CFrame.Angles(math.pi/2,0,0)) | |
544 | weld(handle,newIdMesh("3270017",Vector3.new(0.22,0.22,0.5),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(1,1,1),model)),CFrame.new(0,-2.6,0)*CFrame.Angles(math.pi/2,0,0)) | |
545 | weld(handle,newIdMesh("3270017",Vector3.new(0.25,0.25,0.5),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(1,1,1),model)),CFrame.new(0,0.5,0)*CFrame.Angles(math.pi/2,0,0)) | |
546 | weld(handle,newIdMesh("3270017",Vector3.new(0.25,0.25,0.5),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(1,1,1),model)),CFrame.new(0,-0.5,0)*CFrame.Angles(math.pi/2,0,0)) | |
547 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,-0.4,0)*CFrame.Angles(math.pi/2,0,0)) | |
548 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,-0.3,0)*CFrame.Angles(math.pi/2,0,0)) | |
549 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,-0.2,0)*CFrame.Angles(math.pi/2,0,0)) | |
550 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,-0.1,0)*CFrame.Angles(math.pi/2,0,0)) | |
551 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,0.0,0)*CFrame.Angles(math.pi/2,0,0)) | |
552 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,0.1,0)*CFrame.Angles(math.pi/2,0,0)) | |
553 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,0.2,0)*CFrame.Angles(math.pi/2,0,0)) | |
554 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,0.3,0)*CFrame.Angles(math.pi/2,0,0)) | |
555 | weld(handle,newIdMesh("3270017",Vector3.new(0.21,0.21,1),newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model)),CFrame.new(0,0.4,0)*CFrame.Angles(math.pi/2,0,0)) | |
556 | ||
557 | local core = newPart(Vector3.new(0.2,0.2,0.2),BrickColor.new(0,0,0),model) | |
558 | core.Name = "core" | |
559 | core.Reflectance = 0.5 | |
560 | core.Transparency = 0.25 | |
561 | local coreWeld = weld(handle,newIdMesh("9756362",Vector3.new(0.5,0.5,0.5),core),CFrame.new(0,3.75,0)) | |
562 | Instance.new("PointLight",core) | |
563 | ||
564 | addSoul(8) | |
565 | ||
566 | StaffWeld = weld(character["Torso"],handle,CFrame.new()) | |
567 | animateArm(false, nil, nil) | |
568 | animateStaff(false, nil, nil) | |
569 | ||
570 | function damage(char) | |
571 | if (char == nil) then return end | |
572 | if (char:FindFirstChild("Humanoid") ~= nil) then | |
573 | if (not char.Humanoid:isA("Humanoid")) then | |
574 | char.Parent = nil | |
575 | return | |
576 | end | |
577 | local humanoid = char.Humanoid | |
578 | if (humanoid.Health > 0 and humanoid.Health - (#orbWeld+1) <= 0) then | |
579 | --addSoul(1) | |
580 | end | |
581 | if (char:FindFirstChild("Bubble") ~= nil) then | |
582 | coroutine.resume(coroutine.create(function() | |
583 | if (humanoid ~= nil) then | |
584 | humanoid.WalkSpeed = -16 | |
585 | end | |
586 | wait(5) | |
587 | if (humanoid ~= nil) then | |
588 | humanoid.WalkSpeed = 16 | |
589 | end | |
590 | end)) | |
591 | humanoid.PlatformStand = false | |
592 | char.Bubble.Parent = nil | |
593 | --addSoul(1) | |
594 | end | |
595 | humanoid.Health = humanoid.Health - (#orbWeld+1) | |
596 | end | |
597 | end | |
598 | ||
599 | function damageDistance(char, distance) | |
600 | if (char == nil) then return end | |
601 | if (char:FindFirstChild("Torso") ~= nil) then | |
602 | local torso = char.Torso | |
603 | if ((core.Position - torso.Position).magnitude <= distance) then | |
604 | damage(char) | |
605 | end | |
606 | end | |
607 | end | |
608 | ||
609 | function beam(start, position) | |
610 | coroutine.resume(coroutine.create(function() | |
611 | if (position == nil or start == nil) then return end | |
612 | local distance = (start-position).magnitude | |
613 | local p = newPart(Vector3.new(0.2,0.2,distance),BrickColor.new(0,0,0),model) | |
614 | p.Name = "beam012" | |
615 | p.Anchored = true | |
616 | p.Transparency = 0.25 | |
617 | p.CFrame = CFrame.new((start + position)/2,start) | |
618 | for i = 0, 0.75, 0.1 do | |
619 | p.Transparency = 0.25+i | |
620 | wait(0.01) | |
621 | end | |
622 | p.Parent = nil | |
623 | end)) | |
624 | end | |
625 | ||
626 | tool.Selected:connect(function(mouse) | |
627 | if (not throw) then | |
628 | animateArm(true, CFrame.new(1.5,0.5,0), CFrame.new(0,0.5,0)*CFrame.Angles(-math.pi/2, 0, 0)) | |
629 | animateStaff(true, CFrame.new(0,-1,0)*CFrame.Angles(math.pi + math.pi/2,0,0), CFrame.new()) | |
630 | end | |
631 | ||
632 | mouse.Button1Down:connect(function() | |
633 | local hit = mouse.Hit | |
634 | if (debounce) then | |
635 | return | |
636 | end | |
637 | debounce = true | |
638 | if (mode == "hurt") then | |
639 | beam(core.Position, hit.p) | |
640 | if (mouse.Target ~= nil) then | |
641 | if (mouse.Target.Name == "box") then | |
642 | mouse.Target.Parent = nil | |
643 | else | |
644 | damage(mouse.Target.Parent) | |
645 | end | |
646 | end | |
647 | elseif (mode == "throw") then | |
648 | animateArm(false, nil, nil) | |
649 | StaffWeld.Part0 = nil | |
650 | if (handle:FindFirstChild("BodyPosition") ~= nil) then | |
651 | handle:FindFirstChild("BodyPosition").Parent = nil | |
652 | end | |
653 | if (handle:FindFirstChild("BodyGyro") ~= nil) then | |
654 | handle:FindFirstChild("BodyGyro").Parent = nil | |
655 | end | |
656 | local bp = Instance.new("BodyPosition",handle) | |
657 | bp.maxForce = Vector3.new(100000,100000,100000) | |
658 | bp.position = handle.Position + Vector3.new(0,30,0) | |
659 | local bg = Instance.new("BodyGyro",handle) | |
660 | bg.cframe = CFrame.new(bp.position,hit.p)*CFrame.Angles(math.pi/2,0,0) | |
661 | wait(1) | |
662 | bp.position = hit.p + Vector3.new(0,2,0) | |
663 | wait(0.3) | |
664 | bg.cframe = CFrame.new(bp.position,hit.p)*CFrame.Angles(math.pi/2,0,0) | |
665 | throw = true | |
666 | elseif (mode == "build") then | |
667 | beam(core.Position, hit.p) | |
668 | local p = newPart(Vector3.new(4,4,4),BrickColor.new(0,0,0),Workspace) | |
669 | p.Name = "box" | |
670 | p.Anchored = true | |
671 | p.CanCollide = true | |
672 | p.Transparency = 0.5 | |
673 | p.CFrame = hit*CFrame.Angles(math.random(0,math.pi*2),math.random(0,math.pi*2),math.random(0,math.pi*2)) | |
674 | Instance.new("PointLight",p) | |
675 | elseif (mode == "bubble") then | |
676 | beam(core.Position, hit.p) | |
677 | if (#orbWeld > 0) then | |
678 | if (mouse.Target.Parent:FindFirstChild("Humanoid") ~= nil) then | |
679 | local humanoid = mouse.Target.Parent.Humanoid | |
680 | if (mouse.Target.Parent:FindFirstChild("Bubble") == nil) then | |
681 | if (mouse.Target.Parent:FindFirstChild("Torso") ~= nil) then | |
682 | local torso = mouse.Target.Parent.Torso | |
683 | local part = newPart(Vector3.new(8,8,8),BrickColor.new(0,0,0),mouse.Target.Parent) | |
684 | part.Name = "Bubble" | |
685 | part.Anchored = false | |
686 | part.CanCollide = true | |
687 | part.Shape = 0 | |
688 | part.Transparency = 0.5 | |
689 | part.CFrame = torso.CFrame | |
690 | Instance.new("PointLight",part) | |
691 | weld(torso,part,CFrame.new()) | |
692 | humanoid.PlatformStand = true | |
693 | -- removeSoul(1) | |
694 | end | |
695 | else | |
696 | coroutine.resume(coroutine.create(function() | |
697 | if (humanoid ~= nil) then | |
698 | humanoid.WalkSpeed = -50 | |
699 | end | |
700 | wait(5) | |
701 | if (humanoid ~= nil) then | |
702 | humanoid.WalkSpeed = 16 | |
703 | end | |
704 | end)) | |
705 | humanoid.PlatformStand = false | |
706 | mouse.Target.Parent.Bubble.Parent = nil | |
707 | --addSoul(1) | |
708 | end | |
709 | end | |
710 | end | |
711 | elseif (mode == "beam") then | |
712 | if (not hold and not throw) then | |
713 | animateStaff(true, CFrame.new(0,-1,0)*CFrame.Angles(math.pi,0,0), CFrame.new()) | |
714 | hold = true | |
715 | holdTime = 0 | |
716 | end | |
717 | elseif (mode == "portal") then | |
718 | handle.Anchored = true | |
719 | local p = newCylMesh(newPart(Vector3.new(1,0.25,1),BrickColor.new(0,0,0),model)) | |
720 | p.Anchored = true | |
721 | p.CFrame = CFrame.new(handle.Position) + Vector3.new(0,-2,0) | |
722 | local c = p.CFrame | |
723 | for i=1,15,0.5 do | |
724 | p.Size = p.Size+Vector3.new(0.5,0,0.5) | |
725 | p.CFrame = c | |
726 | wait(0.01) | |
727 | end | |
728 | local p1 = newCylMesh(newPart(Vector3.new(1,0.25,1),BrickColor.new(0,0,0),model)) | |
729 | p1.Anchored = true | |
730 | p1.CFrame = CFrame.new(hit.p) | |
731 | p1.CFrame = CFrame.new(hit.p) | |
732 | local c1 = p1.CFrame | |
733 | handle.Anchored = false | |
734 | for i,v in ipairs(game.Workspace:getChildren()) do | |
735 | if (v:FindFirstChild("Torso") ~= nil) then | |
736 | if ((core.Position - v.Torso.Position).magnitude <= 8) then | |
737 | coroutine.resume(coroutine.create(function() | |
738 | v.Torso.CFrame = CFrame.new(Vector3.new(v.Torso.Position.x,p.Position.y+3,v.Torso.Position.z),v.Torso.CFrame.lookVector) | |
739 | v.Torso.Anchored = true | |
740 | for i=0, 10 do | |
741 | v.Torso.CFrame = v.Torso.CFrame+Vector3.new(0,-1,0) | |
742 | wait(0.1) | |
743 | end | |
744 | v.Torso.CFrame = CFrame.new(v.Torso.Position - (p.Position - p1.Position),v.Torso.CFrame.lookVector) + Vector3.new(0,4,0) | |
745 | for i=0, 10 do | |
746 | v.Torso.CFrame = v.Torso.CFrame+Vector3.new(0,1,0) | |
747 | wait(0.1) | |
748 | end | |
749 | v.Torso.Anchored = false | |
750 | end)) | |
751 | end | |
752 | end | |
753 | end | |
754 | for i=1,15,0.5 do | |
755 | p.Size = p.Size+Vector3.new(-0.5,0,-0.5) | |
756 | p1.Size = p1.Size+Vector3.new(0.5,0,0.5) | |
757 | p.CFrame = c | |
758 | p1.CFrame = c1 | |
759 | wait(0.01) | |
760 | end | |
761 | p.Parent = nil | |
762 | wait(1) | |
763 | for i=1,15,1 do | |
764 | p1.Size = p1.Size+Vector3.new(-1,0,-1) | |
765 | p1.CFrame = c1 | |
766 | wait(0.01) | |
767 | end | |
768 | p1.Parent = nil | |
769 | end | |
770 | debounce = false | |
771 | end) | |
772 | ||
773 | mouse.Button1Up:connect(function() | |
774 | if (debounce2) then | |
775 | return | |
776 | end | |
777 | debounce2 = true | |
778 | if (mode == "beam") then | |
779 | if (hold and holdTime >= 10) then | |
780 | if (#orbWeld > 0) then | |
781 | local p = newSphereMesh(newPart(Vector3.new(4,4,4),BrickColor.new(0,0,0),Workspace)) | |
782 | p.Name = "1" | |
783 | p.Transparency = 0.5 | |
784 | local point = core.CFrame*CFrame.Angles(math.pi/2, 0, 0) | |
785 | p.CFrame = CFrame.new(core.Position + point.lookVector*4,core.Position) | |
786 | Instance.new("PointLight",p) | |
787 | ||
788 | local bs = Instance.new("BodyVelocity",p) | |
789 | bs.velocity = point.lookVector*(2*holdTime)+Vector3.new(0,0.25,0) | |
790 | bs.maxForce = Vector3.new(100000,100000,100000) | |
791 | ||
792 | p.Touched:connect(function(part) | |
793 | if (part.Name ~= "beam012") then | |
794 | if (p.Name == "3") then | |
795 | p.Parent = nil | |
796 | elseif (p.Name == "2") then | |
797 | p.Name = "3" | |
798 | elseif (p.Name == "1") then | |
799 | p.Name = "2" | |
800 | end | |
801 | part.Parent = nil | |
802 | end | |
803 | end) | |
804 | ||
805 | coroutine.resume(coroutine.create(function() | |
806 | for i = 1, 5, 0.01 do | |
807 | if (p.Parent ~= nil) then | |
808 | beam(p.Position, p.Position+Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5))) | |
809 | end | |
810 | wait(0.01) | |
811 | end | |
812 | p.Parent = nil | |
813 | end)) | |
814 | ||
815 | wait(1) | |
816 | --removeSoul(2) | |
817 | end | |
818 | end | |
819 | hold = false | |
820 | holdTime = 0 | |
821 | animateStaff(true, CFrame.new(0,-1,0)*CFrame.Angles(math.pi + math.pi/2,0,0), CFrame.new()) | |
822 | end | |
823 | debounce2 = false | |
824 | end) | |
825 | ||
826 | mouse.KeyDown:connect(function (key) | |
827 | keys[key] = true | |
828 | if (keys["z"]) then | |
829 | mode = "hurt" | |
830 | elseif (keys["x"]) then | |
831 | mode = "bubble" | |
832 | elseif (keys["q"]) then | |
833 | mode = "beam" | |
834 | elseif (keys["c"]) then | |
835 | mode = "drain" | |
836 | elseif (keys["v"]) then | |
837 | mode = "build" | |
838 | elseif (keys["e"]) then | |
839 | if (mode ~= "throw") then | |
840 | mode = "throw" | |
841 | else | |
842 | if (debounce) then return end | |
843 | debounce = true | |
844 | if (throw) then | |
845 | handle:FindFirstChild("BodyPosition").Parent = nil | |
846 | handle:FindFirstChild("BodyGyro").Parent = nil | |
847 | throw = false | |
848 | animateArm(true, CFrame.new(1.5,0.5,0), CFrame.new(0,0.5,0)*CFrame.Angles(-math.pi/2, 0, 0)) | |
849 | animateStaff(true, CFrame.new(0,-1,0)*CFrame.Angles(math.pi + math.pi/2,0,0), CFrame.new()) | |
850 | end | |
851 | debounce = false | |
852 | end | |
853 | elseif (keys["b"]) then | |
854 | if (debounce) then return end | |
855 | debounce = true | |
856 | if (throw) then | |
857 | local p = newCylMesh(newPart(Vector3.new(1,0.25,1),BrickColor.new(0,0,0),model)) | |
858 | p.Anchored = true | |
859 | p.CFrame = CFrame.new(handle.Position) + Vector3.new(0,-2,0) | |
860 | local c = p.CFrame | |
861 | for i=1,30,0.5 do | |
862 | p.Size = p.Size+Vector3.new(0.5,0,0.5) | |
863 | p.CFrame = c | |
864 | wait(0.01) | |
865 | end | |
866 | for i,v in ipairs(game.Workspace:getChildren()) do | |
867 | if (v:FindFirstChild("Torso") ~= nil) then | |
868 | if ((core.Position - v.Torso.Position).magnitude <= 15) then | |
869 | coroutine.resume(coroutine.create(function() | |
870 | v.Torso.CFrame = CFrame.new(Vector3.new(v.Torso.Position.x,p.Position.y+3,v.Torso.Position.z),v.Torso.CFrame.lookVector) | |
871 | v.Torso.Anchored = true | |
872 | for i=0, 10 do | |
873 | v.Torso.CFrame = v.Torso.CFrame+Vector3.new(0,-1,0) | |
874 | wait(0.1) | |
875 | end | |
876 | v:BreakJoints() | |
877 | end)) | |
878 | end | |
879 | end | |
880 | end | |
881 | for i=1,30,1 do | |
882 | p.Size = p.Size+Vector3.new(-1,0,-1) | |
883 | p.CFrame = c | |
884 | wait(0.01) | |
885 | end | |
886 | p.Parent = nil | |
887 | end | |
888 | debounce = false | |
889 | elseif (keys["f"]) then | |
890 | mode = "portal" | |
891 | end | |
892 | end) | |
893 | mouse.KeyUp:connect(function (key) keys[key] = false end) | |
894 | end) | |
895 | ||
896 | tool.Deselected:connect(function() | |
897 | hold = false | |
898 | holdTime = 0 | |
899 | if (not throw) then | |
900 | animateArm(false, nil, nil) | |
901 | animateStaff(false, nil, nil) | |
902 | end | |
903 | end) | |
904 | ||
905 | local y = 0 | |
906 | local x = 0 | |
907 | game:getService("RunService").Stepped:connect(function() | |
908 | if (hold) then | |
909 | holdTime = holdTime+0.5 | |
910 | if(holdTime >= 10) then | |
911 | beam(core.Position, core.Position+Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5))) | |
912 | end | |
913 | end | |
914 | ||
915 | if (mode == "drain") then | |
916 | for q,v in pairs(Workspace:getChildren()) do | |
917 | if (v ~= character and math.random(1,10) == 1) then | |
918 | damageDistance(v, 10) | |
919 | end | |
920 | end | |
921 | beam(core.Position, core.Position+Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5))) | |
922 | end | |
923 | ||
924 | coreWeld.C0 = CFrame.new(0,3.75,0)+Vector3.new(0,math.sin(y)/4,0) | |
925 | ||
926 | for i,v in ipairs(orbWeld) do | |
927 | local radius = getRadius(#orbWeld) | |
928 | ||
929 | local index = x + ((math.pi*2)/#orbWeld)*(i-1) | |
930 | ||
931 | orbWeld[i].C0 = CFrame.new(radius*math.sin(index), 0, radius*math.cos(index)) | |
932 | end | |
933 | ||
934 | if (y < math.pi*2) then | |
935 | y = y + math.pi*2/128 | |
936 | else | |
937 | y = math.pi*2/128 | |
938 | end | |
939 | ||
940 | if (x < math.pi*2) then | |
941 | x = x + math.pi*2/128 | |
942 | else | |
943 | x = math.pi*2/128 | |
944 | end | |
945 | end) |