View difference between Paste ID: q6wczqCy and aFAFiRVz
SHOW: | | - or go back to the newest paste.
1
-- x10Shield --
2
local me = game:GetService("Players").LocalPlayer
3-
local ShieldSize = 8
3+
local ShieldSize = 3
4-
local canCollide = true
4+
local canCollide = false
5
local isLocked = false
6-
local defaultTransparency = 0
6+
local defaultTransparency = 1
7
local whitelist = {"", "", "", ""}
8
9
local scriptBreak = false
10
local followPart = me.Character.HumanoidRootPart
11
local actualList = {}
12
local playerList = {}
13
table.insert(playerList, me)
14
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
15
		for _,wplay in pairs(whitelist) do
16
		if v.Name:lower() == wplay:lower() then
17
			table.insert(playerList, v)
18
		end
19
	end
20
end
21
22
local MainLocation = me.Character.Torso
23
24
function createShield()
25
	pcall(function()
26
		pcall(function()
27
			for i,v in pairs(MainLocation:GetChildren()) do
28
				if v.Name == "weinershield" then
29
					v:Destroy()
30
				end
31
			end
32
		end)
33
		local mod = Instance.new("Model", MainLocation)
34
		mod.Name = "weinershield"
35
		local p1 = Instance.new("Part", mod)
36
		p1.Name = "front"
37
		p1.Size = Vector3.new(ShieldSize,ShieldSize,1)
38
		p1.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y, followPart.Position.Z+(ShieldSize/2))
39
		local b = Instance.new("BlockMesh", p1)
40
		b.Scale = Vector3.new(1, 1, 0)
41
		local p2 = Instance.new("Part", mod)
42
		p2.Name = "back"
43
		p2.Size = Vector3.new(ShieldSize,ShieldSize,1)
44
		p2.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y, followPart.Position.Z-(ShieldSize/2))
45
		local b = Instance.new("BlockMesh", p2)
46
		b.Scale = Vector3.new(1, 1, 0)
47
		local p3 = Instance.new("Part", mod)
48
		p3.Name = "left"
49
		p3.Size = Vector3.new(1,ShieldSize,ShieldSize)
50
		p3.CFrame = CFrame.new(followPart.Position.X+(ShieldSize/2), followPart.Position.Y, followPart.Position.Z)
51
		local b = Instance.new("BlockMesh", p3)
52
		b.Scale = Vector3.new(0, 1, 1)
53
		local p4 = Instance.new("Part", mod)
54
		p4.Name = "right"
55
		p4.Size = Vector3.new(1,ShieldSize,ShieldSize)
56
		p4.CFrame = CFrame.new(followPart.Position.X-(ShieldSize/2), followPart.Position.Y, followPart.Position.Z)
57
		local b = Instance.new("BlockMesh", p4)
58
		b.Scale = Vector3.new(0, 1, 1)
59
		local p5 = Instance.new("Part", mod)
60
		p5.Name = "top"
61
		p5.Size = Vector3.new(ShieldSize,1,ShieldSize)
62
		p5.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y+(ShieldSize/2), followPart.Position.Z)
63
		local b = Instance.new("BlockMesh", p5)
64
		b.Scale = Vector3.new(1, 0, 1)
65
		local p6 = Instance.new("Part", mod)
66
		p6.Name = "bottom"
67
		p6.Size = Vector3.new(ShieldSize,1,ShieldSize)
68
		p6.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y-(ShieldSize/2), followPart.Position.Z)
69
		local b = Instance.new("BlockMesh", p6)
70
		b.Scale = Vector3.new(1, 0, 1)
71
		for i,v in pairs(mod:GetChildren()) do
72
			v.Anchored = true
73
			v.Transparency = defaultTransparency
74
			v.Material = "Neon"
75
			v.TopSurface = "Smooth"
76
			v.BottomSurface = "Smooth"
77
			v.CanCollide = canCollide
78
		end
79
		mod.ChildRemoved:connect(function(a)
80
			game:GetService("RunService").Stepped:wait()
81
			if a.ClassName == "Part" then
82
				createShield()
83
			end
84
		end)
85
	end)
86
end	
87
88
function updateShield()
89
	pcall(function()
90
		char = me.Character
91
		for i,v in pairs(MainLocation:findFirstChild("weinershield"):GetChildren()) do
92
			v.Anchored = true
93
			v.Transparency = defaultTransparency
94
			v.Material = "Neon"
95
			v.TopSurface = "Smooth"
96
			v.BottomSurface = "Smooth"
97
			v.CanCollide = canCollide
98
		end
99
		MainLocation:findFirstChild("weinershield").front.Size = Vector3.new(ShieldSize,ShieldSize,1)
100
		MainLocation:findFirstChild("weinershield").front.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y, followPart.Position.Z+(ShieldSize/2))
101
		MainLocation:findFirstChild("weinershield").back.Size = Vector3.new(ShieldSize,ShieldSize,1)
102
		MainLocation:findFirstChild("weinershield").back.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y, followPart.Position.Z-(ShieldSize/2))
103
		MainLocation:findFirstChild("weinershield").left.Size = Vector3.new(1,ShieldSize,ShieldSize)
104
		MainLocation:findFirstChild("weinershield").left.CFrame = CFrame.new(followPart.Position.X+(ShieldSize/2), followPart.Position.Y, followPart.Position.Z)
105
		MainLocation:findFirstChild("weinershield").right.Size = Vector3.new(1,ShieldSize,ShieldSize)
106
		MainLocation:findFirstChild("weinershield").right.CFrame = CFrame.new(followPart.Position.X-(ShieldSize/2), followPart.Position.Y, followPart.Position.Z)
107
		MainLocation:findFirstChild("weinershield").top.Size = Vector3.new(ShieldSize,1,ShieldSize)
108
		MainLocation:findFirstChild("weinershield").top.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y+(ShieldSize/2), followPart.Position.Z)
109
		MainLocation:findFirstChild("weinershield").bottom.Size = Vector3.new(ShieldSize,1,ShieldSize)
110
		MainLocation:findFirstChild("weinershield").bottom.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y-(ShieldSize/2), followPart.Position.Z)
111
	end)
112
end
113
114
115
local function CreateRegion3FromLocAndSize(Position, Size)
116
	local SizeOffset = Size/2
117
	local Point1 = Position - SizeOffset
118
	local Point2 = Position + SizeOffset
119
	return Region3.new(Point1, Point2)
120
end
121
122
createShield()
123
game:GetService("RunService").Heartbeat:connect(function()
124
	if not scriptBreak then
125
		local me = game:GetService("Players").LocalPlayer
126
		local char = workspace:findFirstChild(me.Name)
127
		actualList = {}
128
		for i,v in pairs(playerList) do
129
			pcall(function()
130
				table.insert(actualList, workspace:findFirstChild(v.Name))
131
			end)
132
		end
133
		if MainLocation:findFirstChild("weinershield") ~= nil then
134
			updateShield()
135
		else
136
			createShield()
137
		end
138
		pcall(function()
139
			local Region = CreateRegion3FromLocAndSize(followPart.Position, Vector3.new(ShieldSize+1,ShieldSize+1,ShieldSize+1))
140
			for _,Part in pairs(workspace:FindPartsInRegion3WithIgnoreList(Region,actualList,math.huge)) do
141
				if Part.Name ~= "Base" and not Part:isDescendantOf(MainLocation:findFirstChild("weinershield")) then
142
					Part:Destroy()
143
				end
144
			end
145
		end)
146
		pcall(function()
147
			for i,v in pairs(actualList) do
148
				if v:findFirstChild("Humanoid") ~= nil then
149
					v.Humanoid.MaxHealth = math.huge
150
					v.Humanoid.Health = math.huge
151
				else
152
					Instance.new("Humanoid", v)
153
				end
154
			end
155
		end)
156
	end
157
end)