View difference between Paste ID: 6Np9BgUw and KduE9A6z
SHOW: | | - or go back to the newest paste.
1
function sandbox(var,func)
2
	local env = getfenv(func)
3
	local newenv = setmetatable({},{
4
		__index = function(self,k)
5
			if k=="script" then
6
				return var
7
			else
8
				return env[k]
9
			end
10
		end,
11
	})
12
	setfenv(func,newenv)
13
	return func
14
end
15
cors = {}
16
mas = Instance.new("Model",game:GetService("Lighting"))
17
Tool0 = Instance.new("Tool")
18
Part1 = Instance.new("Part")
19
CylinderMesh2 = Instance.new("CylinderMesh")
20
Part3 = Instance.new("Part")
21
LocalScript4 = Instance.new("LocalScript")
22
Script5 = Instance.new("Script")
23
LocalScript6 = Instance.new("LocalScript")
24
Script7 = Instance.new("Script")
25
LocalScript8 = Instance.new("LocalScript")
26
Part9 = Instance.new("Part")
27
Script10 = Instance.new("Script")
28
Part11 = Instance.new("Part")
29
Script12 = Instance.new("Script")
30
Part13 = Instance.new("Part")
31
Script14 = Instance.new("Script")
32
Tool0.Name = "Telekinesis Gun"
33
Tool0.Parent = mas
34
Tool0.CanBeDropped = false
35
Part1.Name = "Handle"
36
Part1.Parent = Tool0
37
Part1.Material = Enum.Material.Neon
38
Part1.BrickColor = BrickColor.new("Cyan")
39
Part1.Transparency = 1
40
Part1.Rotation = Vector3.new(0, 15.4200001, 0)
41
Part1.CanCollide = false
42
Part1.FormFactor = Enum.FormFactor.Custom
43
Part1.Size = Vector3.new(1, 0.400000036, 0.300000012)
44
Part1.CFrame = CFrame.new(-55.2695465, 0.696546972, 0.383156985, 0.96399641, -4.98074878e-05, 0.265921414, 4.79998416e-05, 1, 1.32960558e-05, -0.265921414, -5.30653779e-08, 0.96399641)
45
Part1.BottomSurface = Enum.SurfaceType.Smooth
46
Part1.TopSurface = Enum.SurfaceType.Smooth
47
Part1.Color = Color3.new(0.0156863, 0.686275, 0.92549)
48
Part1.Position = Vector3.new(-55.2695465, 0.696546972, 0.383156985)
49
Part1.Orientation = Vector3.new(0, 15.4200001, 0)
50
Part1.Color = Color3.new(0.0156863, 0.686275, 0.92549)
51
CylinderMesh2.Parent = Part1
52
CylinderMesh2.Scale = Vector3.new(0.100000001, 0.100000001, 0.100000001)
53
CylinderMesh2.Scale = Vector3.new(0.100000001, 0.100000001, 0.100000001)
54
Part3.Name = "Shoot"
55
Part3.Parent = Tool0
56
Part3.Material = Enum.Material.Neon
57
Part3.BrickColor = BrickColor.new("Cyan")
58
Part3.Reflectance = 0.30000001192093
59
Part3.Transparency = 1
60
Part3.Rotation = Vector3.new(90.9799957, 0.25999999, -91.409996)
61
Part3.CanCollide = false
62
Part3.FormFactor = Enum.FormFactor.Custom
63
Part3.Size = Vector3.new(0.200000003, 0.25, 0.310000032)
64
Part3.CFrame = CFrame.new(-54.7998123, 0.774299085, -0.757350147, -0.0245519895, 0.99968797, 0.00460194098, 0.0169109926, 0.00501798885, -0.999844491, -0.999555528, -0.0244703442, -0.0170289185)
65
Part3.BottomSurface = Enum.SurfaceType.Smooth
66
Part3.TopSurface = Enum.SurfaceType.Smooth
67
Part3.Color = Color3.new(0.0156863, 0.686275, 0.92549)
68
Part3.Position = Vector3.new(-54.7998123, 0.774299085, -0.757350147)
69
Part3.Orientation = Vector3.new(88.9899979, 164.87999, 73.4700012)
70
Part3.Color = Color3.new(0.0156863, 0.686275, 0.92549)
71
LocalScript4.Parent = Tool0
72
table.insert(cors,sandbox(LocalScript4,function()
73
-- Variables for services
74
local render = game:GetService("RunService").RenderStepped
75
local contextActionService = game:GetService("ContextActionService")
76
local userInputService = game:GetService("UserInputService")
77
78-
local player = game.Players.LocalPlayer
78+
local player = game.Players.Banana_Borealis
79
local mouse = player:GetMouse()
80
local Tool = script.Parent
81
82
-- Variables for Module Scripts
83
local screenSpace = require(Tool:WaitForChild("ScreenSpace"))
84
85
local connection
86
-- Variables for character joints
87
88
local neck, shoulder, oldNeckC0, oldShoulderC0 
89
90
local mobileShouldTrack = true
91
92
-- Thourough check to see if a character is sitting
93
local function amISitting(character)
94
	local t = character.Torso
95
	for _, part in pairs(t:GetConnectedParts(true)) do
96
		if part:IsA("Seat") or part:IsA("VehicleSeat") then
97
			return true
98
		end
99
	end
100
end
101
102
-- Function to call on renderstepped. Orients the character so it is facing towards
103
-- the player mouse's position in world space. If character is sitting then the torso
104
-- should not track
105
local function frame(mousePosition)
106
	-- Special mobile consideration. We don't want to track if the user was touching a ui
107
	-- element such as the movement controls. Just return out of function if so to make sure
108
	-- character doesn't track
109
	if not mobileShouldTrack then return end
110
	
111
	-- Make sure character isn't swiming. If the character is swimming the following code will
112
	-- not work well; the character will not swim correctly. Besides, who shoots underwater?
113
	if player.Character.Humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then
114
		local torso = player.Character.Torso
115
		local head = player.Character.Head
116
		
117
		local toMouse = (mousePosition - head.Position).unit
118
		local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
119
		
120
		local neckAngle = angle
121
	
122
		-- Limit how much the head can tilt down. Too far and the head looks unnatural
123
		if math.deg(neckAngle) > 110 then
124
			neckAngle = math.rad(110)
125
		end
126
		neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
127
		
128
		-- Calculate horizontal rotation
129
		local arm = player.Character:FindFirstChild("Right Arm")
130
		local fromArmPos = torso.Position + torso.CFrame:vectorToWorldSpace(Vector3.new(
131
			torso.Size.X/2 + arm.Size.X/2, torso.Size.Y/2 - arm.Size.Z/2, 0))
132
		local toMouseArm = ((mousePosition - fromArmPos) * Vector3.new(1,0,1)).unit
133
		local look = (torso.CFrame.lookVector * Vector3.new(1,0,1)).unit
134
		local lateralAngle = math.acos(toMouseArm:Dot(look))		
135
		
136
		-- Check for rogue math
137
		if tostring(lateralAngle) == "-1.#IND" then
138
			lateralAngle = 0
139
		end		
140
		
141
		-- Handle case where character is sitting down
142
		if player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Seated then			
143
			
144
			local cross = torso.CFrame.lookVector:Cross(toMouseArm)
145
			if lateralAngle > math.pi/2 then
146
				lateralAngle = math.pi/2
147
			end
148
			if cross.Y < 0 then
149
				lateralAngle = -lateralAngle
150
			end
151
		end	
152
		
153
		-- Turn shoulder to point to mouse
154
		shoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2 + lateralAngle,0)	
155
		
156
		-- If not sitting then aim torso laterally towards mouse
157
		if not amISitting(player.Character) then
158
			torso.CFrame = CFrame.new(torso.Position, torso.Position + (Vector3.new(
159
				mousePosition.X, torso.Position.Y, mousePosition.Z)-torso.Position).unit)
160
		else
161
			--print("sitting")		
162
		end	
163
	end
164
end
165
166
-- Function to bind to render stepped if player is on PC
167
local function pcFrame()
168
	frame(mouse.Hit.p)
169
end
170
171
-- Function to bind to touch moved if player is on mobile
172
local function mobileFrame(touch, processed)
173
	-- Check to see if the touch was on a UI element. If so, we don't want to update anything
174
	if not processed then
175
		-- Calculate touch position in world space. Uses Stravant's ScreenSpace Module script
176
		-- to create a ray from the camera.
177
		local test = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1)
178
		local nearPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1))
179
		nearPos = game.Workspace.CurrentCamera.CoordinateFrame.p - nearPos
180
		local farPos = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y,50) 
181
		farPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(farPos) * -1
182
		if farPos.magnitude > 900 then
183
			farPos = farPos.unit * 900
184
		end
185
		local ray = Ray.new(nearPos, farPos)
186
		local part, pos = game.Workspace:FindPartOnRay(ray, player.Character)
187
		
188
		-- if a position was found on the ray then update the character's rotation
189
		if pos then
190
			frame(pos)
191
		end
192
	end
193
end
194
195
local oldIcon = nil
196
-- Function to bind to equip event
197
local function equip()
198
	local torso = player.Character.Torso
199
	
200
	-- Setup joint variables
201
	neck = torso.Neck	
202
	oldNeckC0 = neck.C0
203
	shoulder = torso:FindFirstChild("Right Shoulder")
204
	oldShoulderC0 = shoulder.C0
205
	
206
	-- Remember old mouse icon and update current
207
	oldIcon = mouse.Icon
208
	mouse.Icon = "rbxassetid:// 2184939409"
209
	
210
	-- Bind TouchMoved event if on mobile. Otherwise connect to renderstepped
211
	if userInputService.TouchEnabled then
212
		connection = userInputService.TouchMoved:connect(mobileFrame)
213
	else
214
		connection = render:connect(pcFrame)
215
	end
216
	
217
	-- Bind TouchStarted and TouchEnded. Used to determine if character should rotate
218
	-- during touch input
219
	userInputService.TouchStarted:connect(function(touch, processed)
220
		mobileShouldTrack = not processed
221
	end)	
222
	userInputService.TouchEnded:connect(function(touch, processed)
223
		mobileShouldTrack = false
224
	end)
225
	
226
	-- Fire server's equip event
227
	game.ReplicatedStorage.ROBLOX_PistolEquipEvent:FireServer()
228
	
229
	-- Bind event for when mouse is clicked to fire server's fire event
230
	mouse.Button1Down:connect(function()
231
		game.ReplicatedStorage.ROBLOX_PistolFireEvent:FireServer(mouse.Hit.p)
232
	end)
233
	
234
	-- Bind reload event to mobile button and r key
235
	contextActionService:BindActionToInputTypes("Reload", function() 
236
		game.ReplicatedStorage.ROBLOX_PistolReloadEvent:FireServer()		
237
	end, true, "")
238
	
239
	-- If game uses filtering enabled then need to update server while tool is
240
	-- held by character.
241
	if workspace.FilteringEnabled then
242
		while connection do
243
			wait()
244
			game.ReplicatedStorage.ROBLOX_PistolUpdateEvent:FireServer(neck.C0, shoulder.C0)
245
		end
246
	end
247
end
248
249
-- Function to bind to Unequip event
250
local function unequip()
251
	if connection then connection:disconnect() end
252
	contextActionService:UnbindAction("Reload")
253
	game.ReplicatedStorage.ROBLOX_PistolUnequipEvent:FireServer()
254
	mouse.Icon = oldIcon
255
	neck.C0 = oldNeckC0
256
	shoulder.C0 = oldShoulderC0
257
end
258
259
-- Bind tool events
260
Tool.Equipped:connect(equip)
261
Tool.Unequipped:connect(unequip)
262
end))
263
Script5.Name = "qPerfectionWeld"
264
Script5.Parent = Tool0
265
table.insert(cors,sandbox(Script5,function()
266
-- Created by Quenty (@Quenty, follow me on twitter).
267
-- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
268
-- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
269
270
--[[ INSTRUCTIONS
271
- Place in the model
272
- Make sure model is anchored
273
- That's it. It will weld the model and all children. 
274
275
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
276
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
277
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
278
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
279
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
280
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
281
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
282
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
283
284
This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes. 
285
]]
286
287
--[[ DOCUMENTATION
288
- Will work in tools. If ran more than once it will not create more than one weld.  This is especially useful for tools that are dropped and then picked up again.
289
- Will work in PBS servers
290
- Will work as long as it starts out with the part anchored
291
- Stores the relative CFrame as a CFrame value
292
- Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
293
- Utilizes a recursive algorith to find all parts in the model
294
- Will reweld on script reparent if the script is initially parented to a tool.
295
- Welds as fast as possible
296
]]
297
298
-- qPerfectionWeld.lua
299
-- Created 10/6/2014
300
-- Author: Quenty
301
-- Version 1.0.3
302
303
-- Updated 10/14/2014 - Updated to 1.0.1
304
--- Bug fix with existing ROBLOX welds ? Repro by asimo3089
305
306
-- Updated 10/14/2014 - Updated to 1.0.2
307
--- Fixed bug fix. 
308
309
-- Updated 10/14/2014 - Updated to 1.0.3
310
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
311
312
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
313
314
315
local function CallOnChildren(Instance, FunctionToCall)
316
	-- Calls a function on each of the children of a certain object, using recursion.  
317
318
	FunctionToCall(Instance)
319
320
	for _, Child in next, Instance:GetChildren() do
321
		CallOnChildren(Child, FunctionToCall)
322
	end
323
end
324
325
local function GetNearestParent(Instance, ClassName)
326
	-- Returns the nearest parent of a certain class, or returns nil
327
328
	local Ancestor = Instance
329
	repeat
330
		Ancestor = Ancestor.Parent
331
		if Ancestor == nil then
332
			return nil
333
		end
334
	until Ancestor:IsA(ClassName)
335
336
	return Ancestor
337
end
338
339
local function GetBricks(StartInstance)
340
	local List = {}
341
342
	-- if StartInstance:IsA("BasePart") then
343
	-- 	List[#List+1] = StartInstance
344
	-- end
345
346
	CallOnChildren(StartInstance, function(Item)
347
		if Item:IsA("BasePart") then
348
			List[#List+1] = Item;
349
		end
350
	end)
351
352
	return List
353
end
354
355
local function Modify(Instance, Values)
356
	-- Modifies an Instance by using a table.  
357
358
	assert(type(Values) == "table", "Values is not a table");
359
360
	for Index, Value in next, Values do
361
		if type(Index) == "number" then
362
			Value.Parent = Instance
363
		else
364
			Instance[Index] = Value
365
		end
366
	end
367
	return Instance
368
end
369
370
local function Make(ClassType, Properties)
371
	-- Using a syntax hack to create a nice way to Make new items.  
372
373
	return Modify(Instance.new(ClassType), Properties)
374
end
375
376
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
377
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
378
379
local function HasWheelJoint(Part)
380
	for _, SurfaceName in pairs(Surfaces) do
381
		for _, HingSurfaceName in pairs(HingSurfaces) do
382
			if Part[SurfaceName].Name == HingSurfaceName then
383
				return true
384
			end
385
		end
386
	end
387
	
388
	return false
389
end
390
391
local function ShouldBreakJoints(Part)
392
	--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
393
	--  definitely some edge cases. 
394
395
	if NEVER_BREAK_JOINTS then
396
		return false
397
	end
398
	
399
	if HasWheelJoint(Part) then
400
		return false
401
	end
402
	
403
	local Connected = Part:GetConnectedParts()
404
	
405
	if #Connected == 1 then
406
		return false
407
	end
408
	
409
	for _, Item in pairs(Connected) do
410
		if HasWheelJoint(Item) then
411
			return false
412
		elseif not Item:IsDescendantOf(script.Parent) then
413
			return false
414
		end
415
	end
416
	
417
	return true
418
end
419
420
local function WeldTogether(Part0, Part1, JointType, WeldParent)
421
	--- Weld's 2 parts together
422
	-- @param Part0 The first part
423
	-- @param Part1 The second part (Dependent part most of the time).
424
	-- @param [JointType] The type of joint. Defaults to weld.
425
	-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
426
	-- @return The weld created.
427
428
	JointType = JointType or "Weld"
429
	local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
430
	
431
	local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
432
	Modify(NewWeld, {
433
		Name = "qCFrameWeldThingy";
434
		Part0  = Part0;
435
		Part1  = Part1;
436
		C0     = CFrame.new();--Part0.CFrame:inverse();
437
		C1     = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
438
		Parent = Part1;
439
	})
440
441
	if not RelativeValue then
442
		RelativeValue = Make("CFrameValue", {
443
			Parent     = Part1;
444
			Name       = "qRelativeCFrameWeldValue";
445
			Archivable = true;
446
			Value      = NewWeld.C1;
447
		})
448
	end
449
450
	return NewWeld
451
end
452
453
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
454
	-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
455
	-- @param MainPart The part to weld the model to (can be in the model).
456
	-- @param [JointType] The type of joint. Defaults to weld. 
457
	-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
458
	
459
	for _, Part in pairs(Parts) do
460
		if ShouldBreakJoints(Part) then
461
			Part:BreakJoints()
462
		end
463
	end
464
	
465
	for _, Part in pairs(Parts) do
466
		if Part ~= MainPart then
467
			WeldTogether(MainPart, Part, JointType, MainPart)
468
		end
469
	end
470
471
	if not DoNotUnanchor then
472
		for _, Part in pairs(Parts) do
473
			Part.Anchored = false
474
		end
475
		MainPart.Anchored = false
476
	end
477
end
478
479
local function PerfectionWeld()	
480
	local Tool = GetNearestParent(script, "Tool")
481
482
	local Parts = GetBricks(script.Parent)
483
	local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
484
485
	if PrimaryPart then
486
		WeldParts(Parts, PrimaryPart, "Weld", false)
487
	else
488
		warn("qWeld - Unable to weld part")
489
	end
490
	
491
	return Tool
492
end
493
494
local Tool = PerfectionWeld()
495
496
497
if Tool and script.ClassName == "Script" then
498
	--- Don't bother with local scripts
499
500
	script.Parent.AncestryChanged:connect(function()
501
		PerfectionWeld()
502
	end)
503
end
504
505
-- Created by Quenty (@Quenty, follow me on twitter).
506
507
end))
508
LocalScript6.Name = "Animate"
509
LocalScript6.Parent = Tool0
510
table.insert(cors,sandbox(LocalScript6,function()
511
local arms = nil
512
local torso = nil
513
local welds = {}
514
local Tool = script.Parent
515
local neck = nil
516
local orginalC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
517
518
function Equip(mouse)
519
wait(0.01)
520
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
521
head = Tool.Parent:FindFirstChild("Head") 
522
torso = Tool.Parent:FindFirstChild("Torso")
523
if neck == nil then 
524
neck = Tool.Parent:FindFirstChild("Torso").Neck
525
end 
526
if arms ~= nil and torso ~= nil then
527
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
528
if sh ~= nil then
529
local yes = true
530
if yes then
531
yes = false
532
sh[1].Part1 = nil
533
sh[2].Part1 = nil
534
local weld1 = Instance.new("Weld")
535
weld1.Part0 = head
536
weld1.Parent = head
537
weld1.Part1 = arms[1]
538
welds[1] = weld1
539
local weld2 = Instance.new("Weld")
540
weld2.Part0 = head
541
weld2.Parent = head
542
weld2.Part1 = arms[2]
543
welds[2] = weld2
544
-------------------------here
545
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
546
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
547
	mouse.Move:connect(function ()
548
		--local Direction = Tool.Direction.Value 
549
		local Direction = mouse.Hit.p
550
		local b = head.Position.Y-Direction.Y
551
		local dist = (head.Position-Direction).magnitude
552
		local answer = math.asin(b/dist)
553
		neck.C0=orginalC0*CFrame.fromEulerAnglesXYZ(answer,0,0)
554
		wait(0.1)
555
	end)end
556
else
557
print("sh")
558
end
559
else
560
print("arms")
561
end
562
end
563
564
function Unequip(mouse)
565
if arms ~= nil and torso ~= nil then
566
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
567
if sh ~= nil then
568
local yes = true
569
if yes then
570
yes = false
571
	neck.C0 = orginalC0
572
573
sh[1].Part1 = arms[1]
574
sh[2].Part1 = arms[2]
575
welds[1].Parent = nil
576
welds[2].Parent = nil
577
end
578
else
579
print("sh")
580
end
581
else
582
print("arms")
583
end
584
end
585
Tool.Equipped:connect(Equip)
586
Tool.Unequipped:connect(Unequip)
587
588
function Animate()
589
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
590
	if Tool.AnimateValue.Value == "Shoot" then 
591
		local weld1 = welds[1]
592
		local weld2 = welds[2]
593
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
594
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
595
		wait(0.00001)
596
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.05, math.rad(-90))
597
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
598
		wait(0.00001)
599
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.1, math.rad(-90))
600
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
601
		wait(0.00001)
602
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.3, math.rad(-90))
603
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
604
		wait(0.00001)
605
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.35, math.rad(-90))
606
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
607
		wait(0.00001)
608
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
609
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
610
		wait(0.00001)
611
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
612
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)	
613
		Tool.AnimateValue.Value = "None"
614
	end 
615
	if Tool.AnimateValue.Value == "Reload" then 
616
		local weld1 = welds[1]
617
		local weld2 = welds[2]
618
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
619
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
620
		wait(0.0001)
621
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
622
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
623
		wait(0.0001)
624
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
625
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
626
		wait(0.0001)
627
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
628
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-100), math.rad(-15), 0)
629
		wait(0.0001)
630
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
631
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-105), math.rad(-15), 0)
632
		wait(0.0001)
633
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
634
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
635
		wait(0.0001)
636
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
637
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
638
		wait(0.0001)
639
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.45, math.rad(-90))
640
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
641
		wait(0.0001)
642
		weld1.C1 = CFrame.new(-0.5+1.5, 0.9, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.5, math.rad(-90))
643
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
644
		wait(0.0001)
645
		weld1.C1 = CFrame.new(-0.5+1.5, 1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.55, math.rad(-90))
646
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
647
		wait(0.0001)
648
		weld1.C1 = CFrame.new(-0.5+1.5, 1.1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.57, math.rad(-90))
649
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
650
		wait(0.0001)
651
		weld1.C1 = CFrame.new(-0.5+1.5, 1.2, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
652
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
653
		wait(0.0001)
654
		weld1.C1 = CFrame.new(-0.5+1.5, 1.3, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
655
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
656
		wait(0.0001)
657
		weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
658
		weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)	
659
		Tool.AnimateValue.Value = "None"
660
	end 
661
end 
662
663
Tool.AnimateValue.Changed:connect(Animate)
664
665
end))
666
Script7.Name = "LineConnect"
667
Script7.Parent = Tool0
668
Script7.Disabled = true
669
table.insert(cors,sandbox(Script7,function()
670
wait()
671
local check = script.Part2
672
local part1 = script.Part1.Value
673
local part2 = script.Part2.Value
674
local parent = script.Par.Value
675
local color = script.Color
676
local line = Instance.new("Part")
677
line.TopSurface = 0
678
line.BottomSurface = 0
679
line.Reflectance = .5
680
line.Name = "Laser"
681
line.Transparency = 0.6
682
line.Locked = true
683
line.CanCollide = false
684
line.Anchored = true
685
line.formFactor = 0
686
line.Size = Vector3.new(0.4,0.4,1)
687
local mesh = Instance.new("BlockMesh")
688
mesh.Parent = line
689
while true do
690
	if (check.Value==nil) then break end
691
	if (part1==nil or part2==nil or parent==nil) then break end
692
	if (part1.Parent==nil or part2.Parent==nil) then break end
693
	if (parent.Parent==nil) then break end
694
	local lv = CFrame.new(part1.Position,part2.Position)
695
	local dist = (part1.Position-part2.Position).magnitude
696
	line.Parent = parent
697
	line.Material = "Neon"
698
	line.BrickColor = color.Value.BrickColor
699
	line.Reflectance = color.Value.Reflectance
700
	line.Transparency = "0.2"
701
	line.CFrame = CFrame.new(part1.Position+lv.lookVector*dist/2)
702
	line.CFrame = CFrame.new(line.Position,part2.Position)
703
	mesh.Scale = Vector3.new(.25,.25,dist)
704
	wait()
705
end
706
line:remove()
707
script:remove() 
708
end))
709
LocalScript8.Name = "MainScript"
710
LocalScript8.Parent = Tool0
711
table.insert(cors,sandbox(LocalScript8,function()
712
--Physics gun created by Killersoldier45
713
wait() 
714
tool = script.Parent
715
lineconnect = tool.LineConnect
716
object = nil
717
mousedown = false
718
found = false
719
BP = Instance.new("BodyPosition")
720
BP.maxForce = Vector3.new(math.huge*math.huge,math.huge*math.huge,math.huge*math.huge) --pwns everyone elses bodyposition
721
BP.P = BP.P*10 --faster movement. less bounceback.
722
dist = nil
723
point = Instance.new("Part")
724
point.Locked = true
725
point.Anchored = true
726
point.formFactor = 0
727
point.Shape = 0
728
point.Material = 'Neon'
729
point.BrickColor = BrickColor.new("Toothpaste")
730
point.Size = Vector3.new(1,1,1)
731
point.CanCollide = false
732
local mesh = Instance.new("SpecialMesh")
733
mesh.MeshType = "Sphere"
734
mesh.Scale = Vector3.new(.2,.2,.2)
735
mesh.Parent = point
736
handle = tool.Shoot
737
front = tool.Shoot
738
color = tool.Shoot
739
objval = nil
740
local hooked = false 
741
local hookBP = BP:clone() 
742
hookBP.maxForce = Vector3.new(30000,30000,30000) 
743
744
function LineConnect(part1,part2,parent)
745
	local p1 = Instance.new("ObjectValue")
746
	p1.Value = part1
747
	p1.Name = "Part1"
748
	local p2 = Instance.new("ObjectValue")
749
	p2.Value = part2
750
	p2.Name = "Part2"
751
	local par = Instance.new("ObjectValue")
752
	par.Value = parent
753
	par.Name = "Par"
754
	local col = Instance.new("ObjectValue")
755
	col.Value = color
756
	col.Name = "Color"
757
	local s = lineconnect:clone()
758
	s.Disabled = false
759
	p1.Parent = s
760
	p2.Parent = s
761
	par.Parent = s
762
	col.Parent = s
763
	s.Parent = workspace
764
	if (part2==object) then
765
		objval = p2
766
	end
767
end
768
769
function onButton1Down(mouse)
770
	if (mousedown==true) then return end
771
	mousedown = true
772
	coroutine.resume(coroutine.create(function()
773
		local p = point:clone()
774
		p.Parent = tool
775
		LineConnect(front,p,workspace)
776
		while (mousedown==true) do
777
			p.Parent = tool
778
			if (object==nil) then
779
				if (mouse.Target==nil) then
780
					local lv = CFrame.new(front.Position,mouse.Hit.p)
781
					p.CFrame = CFrame.new(front.Position+(lv.lookVector*1000))
782
				else
783
					p.CFrame = CFrame.new(mouse.Hit.p)
784
				end
785
			else
786
				LineConnect(front,object,workspace)
787
				break
788
			end
789
			wait()
790
		end
791
		p:remove()
792
	end))
793
	while (mousedown==true) do
794
		if (mouse.Target~=nil) then
795
			local t = mouse.Target
796
			if (t.Anchored==false) then
797
				object = t
798
				dist = (object.Position-front.Position).magnitude
799
				break
800
			end
801
		end
802
		wait()
803
	end
804
	while (mousedown==true) do
805
		if (object.Parent==nil) then break end
806
		local lv = CFrame.new(front.Position,mouse.Hit.p)
807
		BP.Parent = object
808
		BP.position = front.Position+lv.lookVector*dist
809
		wait()
810
	end
811
	BP:remove()
812
	object = nil
813
	objval.Value = nil
814
end
815
816
function onKeyDown(key,mouse) 
817
	local key = key:lower() 
818
	local yesh = false 
819
	if (key=="q") then 
820
		if (dist>=5) then 
821
			dist = dist-5 
822
		end 
823
	end 
824
	if key == "t" then 
825
	if (object==nil) then return end 
826
	for _,v in pairs(object:children()) do 
827
	if v.className == "BodyGyro" then 
828
	return nil 
829
	end 
830
	end 
831
	BG = Instance.new("BodyGyro") 
832
	BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge) 
833
	BG.cframe = CFrame.new(object.CFrame.p) 
834
	BG.Parent = object 
835
	repeat wait() until(object.CFrame == CFrame.new(object.CFrame.p)) 
836
	BG.Parent = nil 
837
	if (object==nil) then return end 
838
	for _,v in pairs(object:children()) do 
839
	if v.className == "BodyGyro" then 
840
	v.Parent = nil 
841
	end 
842
	end 
843
	object.Velocity = Vector3.new(0,0,0) 
844
	object.RotVelocity = Vector3.new(0,0,0) 
845
	end 
846
	if (key=="e") then
847
		dist = dist+5
848
	end
849
	if (string.byte(key)==27) then 
850
		if (object==nil) then return end
851
		local e = Instance.new("Explosion")
852
		e.Parent = workspace
853
		e.Position = object.Position
854
		color.BrickColor = BrickColor.Black()
855
		point.BrickColor = BrickColor.White() 
856
		wait(.48)
857
		color.BrickColor = BrickColor.White() 
858
		point.BrickColor = BrickColor.Black() 
859
	end
860
	if (key=="") then 
861
		if not hooked then 
862
		if (object==nil) then return end 
863
		hooked = true 
864
		hookBP.position = object.Position 
865
		if tool.Parent:findFirstChild("Torso") then 
866
		hookBP.Parent = tool.Parent.Torso 
867
		if dist ~= (object.Size.x+object.Size.y+object.Size.z)+5 then 
868
		dist = (object.Size.x+object.Size.y+object.Size.z)+5 
869
		end 
870
		end 
871
		else 
872
		hooked = false 
873
		hookBP.Parent = nil 
874
		end 
875
	end 
876
	if (key=="r") then 
877
		if (object==nil) then return end 
878
		color.BrickColor = BrickColor.new("Toothpaste") 
879
		point.BrickColor = BrickColor.new("Toothpaste") 
880
		object.Parent = nil 
881
		wait(.48) 
882
		color.BrickColor = BrickColor.new("Toothpaste")
883
		point.BrickColor = BrickColor.new("Toothpaste")
884
	end 
885
	if (key=="x") then 
886
	if (object==nil) then return end 
887
	local New = object:clone() 
888
	New.Parent = object.Parent 
889
	for _,v in pairs(New:children()) do 
890
	if v.className == "BodyPosition" or v.className == "BodyGyro" then 
891
	v.Parent = nil 
892
	end 
893
	end 
894
	object = New 
895
	mousedown = false 
896
	mousedown = true 
897
	LineConnect(front,object,workspace) 
898
		while (mousedown==true) do
899
		if (object.Parent==nil) then break end
900
		local lv = CFrame.new(front.Position,mouse.Hit.p)
901
		BP.Parent = object
902
		BP.position = front.Position+lv.lookVector*dist
903
		wait()
904
	end
905
	BP:remove()
906
	object = nil
907
	objval.Value = nil
908
	end 
909
	if (key=="c") then 
910
		local Cube = Instance.new("Part") 
911
		Cube.Locked = true 
912
		Cube.Size = Vector3.new(4,4,4) 
913
		Cube.formFactor = 0 
914
		Cube.TopSurface = 0 
915
		Cube.BottomSurface = 0 
916
		Cube.Name = "WeightedStorageCube" 
917
		Cube.Parent = workspace 
918
		Cube.CFrame = CFrame.new(mouse.Hit.p) + Vector3.new(0,2,0) 
919
		for i = 0,5 do 
920
			local Decal = Instance.new("Decal") 
921
			Decal.Texture = "http://www.roblox.com/asset/?id=2662260" 
922
			Decal.Face = i 
923
			Decal.Name = "WeightedStorageCubeDecal" 
924
			Decal.Parent = Cube 
925
		end 
926
	end 
927
	if (key=="") then 
928
		if dist ~= 15 then 
929
			dist = 15 
930
		end 
931
	end 
932
end
933
934
function onEquipped(mouse)
935
	keymouse = mouse
936
	local char = tool.Parent
937
	human = char.Humanoid
938
	human.Changed:connect(function() if (human.Health==0) then mousedown = false BP:remove() point:remove() tool:remove() end end)
939
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
940
	mouse.Button1Up:connect(function() mousedown = false end)
941
	mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
942
	mouse.Icon = "rbxassetid://2184939409"
943
end
944
945
tool.Equipped:connect(onEquipped)
946
end))
947
Part9.Name = "GlowPart"
948
Part9.Parent = Tool0
949
Part9.Material = Enum.Material.Neon
950
Part9.BrickColor = BrickColor.new("Cyan")
951
Part9.Transparency = 0.5
952
Part9.Rotation = Vector3.new(0, -89.5899963, 0)
953
Part9.Shape = Enum.PartType.Cylinder
954
Part9.Size = Vector3.new(1.20000005, 0.649999976, 2)
955
Part9.CFrame = CFrame.new(-54.8191681, 0.773548007, -0.0522949994, 0.00736002205, 4.68389771e-11, -0.999974668, 4.72937245e-11, 1, 1.41590961e-10, 0.999974668, 5.09317033e-11, 0.00736002252)
956
Part9.Color = Color3.new(0.0156863, 0.686275, 0.92549)
957
Part9.Position = Vector3.new(-54.8191681, 0.773548007, -0.0522949994)
958
Part9.Orientation = Vector3.new(0, -89.5799942, 0)
959
Part9.Color = Color3.new(0.0156863, 0.686275, 0.92549)
960
Script10.Name = "Glow Script"
961
Script10.Parent = Part9
962
table.insert(cors,sandbox(Script10,function()
963
while true do
964
wait(0.05)
965
script.Parent.Transparency = .5
966
wait(0.05)
967
script.Parent.Transparency = .6
968
wait(0.05)
969
script.Parent.Transparency = .7
970
wait(0.05)
971
script.Parent.Transparency = .8
972
wait(0.05)
973
script.Parent.Transparency = .9
974
wait(0.05)
975
script.Parent.Transparency = .8
976
wait(0.05)
977
script.Parent.Transparency = .7
978
wait(0.05)
979
script.Parent.Transparency = .6
980
wait(0.05)
981
script.Parent.Transparency = .5
982
end
983
984
end))
985
Part11.Name = "GlowPart"
986
Part11.Parent = Tool0
987
Part11.Material = Enum.Material.Neon
988
Part11.BrickColor = BrickColor.new("Cyan")
989
Part11.Transparency = 0.5
990
Part11.Rotation = Vector3.new(-89.3799973, -55.7399979, -89.25)
991
Part11.Size = Vector3.new(0.280000001, 0.25999999, 0.200000003)
992
Part11.CFrame = CFrame.new(-54.9808807, 0.99843204, 0.799362957, 0.00736002205, 0.562958956, -0.826454222, 4.72937245e-11, 0.826475084, 0.56297338, 0.999974668, -0.00414349511, 0.00608287565)
993
Part11.Color = Color3.new(0.0156863, 0.686275, 0.92549)
994
Part11.Position = Vector3.new(-54.9808807, 0.99843204, 0.799362957)
995
Part11.Orientation = Vector3.new(-34.2599983, -89.5799942, 0)
996
Part11.Color = Color3.new(0.0156863, 0.686275, 0.92549)
997
Script12.Name = "Glow Script"
998
Script12.Parent = Part11
999
table.insert(cors,sandbox(Script12,function()
1000
while true do
1001
wait(0.05)
1002
script.Parent.Transparency = .5
1003
wait(0.05)
1004
script.Parent.Transparency = .6
1005
wait(0.05)
1006
script.Parent.Transparency = .7
1007
wait(0.05)
1008
script.Parent.Transparency = .8
1009
wait(0.05)
1010
script.Parent.Transparency = .9
1011
wait(0.05)
1012
script.Parent.Transparency = .8
1013
wait(0.05)
1014
script.Parent.Transparency = .7
1015
wait(0.05)
1016
script.Parent.Transparency = .6
1017
wait(0.05)
1018
script.Parent.Transparency = .5
1019
end
1020
1021
end))
1022
Part13.Name = "GlowPart"
1023
Part13.Parent = Tool0
1024
Part13.Material = Enum.Material.Neon
1025
Part13.BrickColor = BrickColor.new("Cyan")
1026
Part13.Transparency = 0.5
1027
Part13.Rotation = Vector3.new(95.1500015, -53.8199997, 98.0799942)
1028
Part13.Size = Vector3.new(0.280000001, 0.25999999, 0.200000003)
1029
Part13.CFrame = CFrame.new(-54.5909271, 0.978429973, 0.799362957, -0.0830051303, -0.584483683, -0.807150841, 0.0241250042, 0.808528602, -0.58796227, 0.996258855, -0.0682764053, -0.0530113392)
1030
Part13.Color = Color3.new(0.0156863, 0.686275, 0.92549)
1031
Part13.Position = Vector3.new(-54.5909271, 0.978429973, 0.799362957)
1032
Part13.Orientation = Vector3.new(36.0099983, -93.7599945, 1.70999992)
1033
Part13.Color = Color3.new(0.0156863, 0.686275, 0.92549)
1034
Script14.Name = "Glow Script"
1035
Script14.Parent = Part13
1036
table.insert(cors,sandbox(Script14,function()
1037
while true do
1038
wait(0.05)
1039
script.Parent.Transparency = .5
1040
wait(0.05)
1041
script.Parent.Transparency = .6
1042
wait(0.05)
1043
script.Parent.Transparency = .7
1044
wait(0.05)
1045
script.Parent.Transparency = .8
1046
wait(0.05)
1047
script.Parent.Transparency = .9
1048
wait(0.05)
1049
script.Parent.Transparency = .8
1050
wait(0.05)
1051
script.Parent.Transparency = .7
1052
wait(0.05)
1053
script.Parent.Transparency = .6
1054
wait(0.05)
1055
script.Parent.Transparency = .5
1056
end
1057
1058
end))
1059
for i,v in pairs(mas:GetChildren()) do
1060-
	v.Parent = game:GetService("Players").LocalPlayer.Backpack
1060+
	v.Parent = game:GetService("Players").Banana_Borealis.Backpack
1061
	pcall(function() v:MakeJoints() end)
1062
end
1063
mas:Destroy()
1064
for i,v in pairs(cors) do
1065
	spawn(function()
1066
		pcall(v)
1067
	end)
1068
end