View difference between Paste ID: aKmxjyjp and hwBG95pq
SHOW: | | - or go back to the newest paste.
1
if script.Parent.className~="HopperBin" then
2
ma=Instance.new("HopperBin")
3
ma.Name="Laser "
4
--ma.Parent=game.Lighting
5-
ma.Parent=game.Players.YOURNAME.Backpack
5+
ma.Parent=game.Players.xVitality.Backpack
6
script.Parent=ma
7
end
8
9
local Selected = false
10
local Shoot = true
11
function Click(Target)
12
if(Target.Target.Parent:findFirstChild("Humanoid")~=nil)then
13
Target.Target.Parent.Humanoid.Health = 0
14
end
15
local P = Instance.new("Part")
16
P.Name = "Laser"
17
local Place0 = script.Parent.Parent.Parent.Character["Left Arm"].CFrame
18
P.formFactor = 0
19
P.Size = Vector3.new(1,1,(Place0.p - Target.Hit.p).magnitude)
20
P.CFrame = CFrame.new((Place0.p + Target.Hit.p)/2,Place0.p)
21
P.Parent = game.Workspace
22
P.Color = Color3.new(0,0,1)
23
P.Transparency = 0.5
24
P.Reflectance = 0.5
25
P.Anchored = true
26
P.CanCollide = false
27
local E = Instance.new("Explosion")
28
E.Position = Target.Hit.p
29
E.Parent = game.Workspace
30
for i = 1,10 do
31
P.Transparency = 0.5+(i*0.05)
32
P.Reflectance = i*0.05
33
wait(0.1)
34
end
35
P:Rremove()
36
end
37
function Select(Mouse)
38
local Arm = script.Parent.Parent.Parent.Character:findFirstChild("Left Arm")
39
if(Arm==nil)then
40
script.Parent:Remove()
41
script:Remove()
42
end
43
Selected = true
44
local Torso = script.Parent.Parent.Parent.Character:findFirstChild("Torso")
45
if(Torso==nil)then
46
script.Parent:Remove()
47
script:Remove()
48
end
49
local ArmWeld = Torso:findFirstChild("Left Shoulder")
50
if(ArmWeld~=nil)then
51
ArmWeld.Parent = nil
52
end
53
Mouse.Button1Down:connect(function()Click(Mouse)end)
54
Arm.Anchored = true
55
while Selected do
56
local Place0 = script.Parent.Parent.Parent.Character.Torso.CFrame
57
Place0 = Place0 + ((Place0 * CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)).lookVector * 0.5) + (Place0 * CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)).lookVector
58
local Place1 = Place0 + ((Place0.p-Mouse.Hit.p).unit * -2)
59
Arm.CFrame = CFrame.new((Place0.p + Place1.p)/2,Place0.p) * CFrame.fromEulerAnglesXYZ(-math.pi/2,0,0)
60
wait()
61
end
62
Arm.Anchored = false
63
if(ArmWeld~=nil)then
64
ArmWeld.Parent = Torso
65
end
66
end
67
function Deselect()
68
Selected = false
69
end
70
script.Parent.Selected:connect(Select)
71
script.Parent.Deselected:connect(Deselect)