View difference between Paste ID: 54PbimzN and aFAFiRVz
SHOW: | | - or go back to the newest paste.
1-
-- x10Shield --
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 print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end -- x10Shield --
6
local me = game:GetService("Players").LocalPlayer
7
local ShieldSize = 8
8
local canCollide = true
9
local isLocked = false
10
local defaultTransparency = 0
11
local whitelist = {"", "", "", ""}
12
13
local scriptBreak = false
14
local followPart = me.Character.HumanoidRootPart
15
local actualList = {}
16
local playerList = {}
17
table.insert(playerList, me)
18
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
19
		for _,wplay in pairs(whitelist) do
20
		if v.Name:lower() == wplay:lower() then
21
			table.insert(playerList, v)
22
		end
23
	end
24
end
25
26
local MainLocation = me.Character.Torso
27
28
function createShield()
29
	pcall(function()
30
		pcall(function()
31
			for i,v in pairs(MainLocation:GetChildren()) do
32
				if v.Name == "weinershield" then
33
					v:Destroy()
34
				end
35
			end
36
		end)
37
		local mod = Instance.new("Model", MainLocation)
38
		mod.Name = "weinershield"
39
		local p1 = Instance.new("Part", mod)
40
		p1.Name = "front"
41
		p1.Size = Vector3.new(ShieldSize,ShieldSize,1)
42
		p1.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y, followPart.Position.Z+(ShieldSize/2))
43
		local b = Instance.new("BlockMesh", p1)
44
		b.Scale = Vector3.new(1, 1, 0)
45
		local p2 = Instance.new("Part", mod)
46
		p2.Name = "back"
47
		p2.Size = Vector3.new(ShieldSize,ShieldSize,1)
48
		p2.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y, followPart.Position.Z-(ShieldSize/2))
49
		local b = Instance.new("BlockMesh", p2)
50
		b.Scale = Vector3.new(1, 1, 0)
51
		local p3 = Instance.new("Part", mod)
52
		p3.Name = "left"
53
		p3.Size = Vector3.new(1,ShieldSize,ShieldSize)
54
		p3.CFrame = CFrame.new(followPart.Position.X+(ShieldSize/2), followPart.Position.Y, followPart.Position.Z)
55
		local b = Instance.new("BlockMesh", p3)
56
		b.Scale = Vector3.new(0, 1, 1)
57
		local p4 = Instance.new("Part", mod)
58
		p4.Name = "right"
59
		p4.Size = Vector3.new(1,ShieldSize,ShieldSize)
60
		p4.CFrame = CFrame.new(followPart.Position.X-(ShieldSize/2), followPart.Position.Y, followPart.Position.Z)
61
		local b = Instance.new("BlockMesh", p4)
62
		b.Scale = Vector3.new(0, 1, 1)
63
		local p5 = Instance.new("Part", mod)
64
		p5.Name = "top"
65
		p5.Size = Vector3.new(ShieldSize,1,ShieldSize)
66
		p5.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y+(ShieldSize/2), followPart.Position.Z)
67
		local b = Instance.new("BlockMesh", p5)
68
		b.Scale = Vector3.new(1, 0, 1)
69
		local p6 = Instance.new("Part", mod)
70
		p6.Name = "bottom"
71
		p6.Size = Vector3.new(ShieldSize,1,ShieldSize)
72
		p6.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y-(ShieldSize/2), followPart.Position.Z)
73
		local b = Instance.new("BlockMesh", p6)
74
		b.Scale = Vector3.new(1, 0, 1)
75
		for i,v in pairs(mod:GetChildren()) do
76
			v.Anchored = true
77
			v.Transparency = defaultTransparency
78
			v.Material = "Neon"
79
			v.TopSurface = "Smooth"
80
			v.BottomSurface = "Smooth"
81
			v.CanCollide = canCollide
82
		end
83
		mod.ChildRemoved:connect(function(a)
84
			game:GetService("RunService").Stepped:wait()
85
			if a.ClassName == "Part" then
86
				createShield()
87
			end
88
		end)
89
	end)
90
end	
91
92
function updateShield()
93
	pcall(function()
94
		char = me.Character
95
		for i,v in pairs(MainLocation:findFirstChild("weinershield"):GetChildren()) do
96
			v.Anchored = true
97
			v.Transparency = defaultTransparency
98
			v.Material = "Neon"
99
			v.TopSurface = "Smooth"
100
			v.BottomSurface = "Smooth"
101
			v.CanCollide = canCollide
102
		end
103
		MainLocation:findFirstChild("weinershield").front.Size = Vector3.new(ShieldSize,ShieldSize,1)
104
		MainLocation:findFirstChild("weinershield").front.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y, followPart.Position.Z+(ShieldSize/2))
105
		MainLocation:findFirstChild("weinershield").back.Size = Vector3.new(ShieldSize,ShieldSize,1)
106
		MainLocation:findFirstChild("weinershield").back.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y, followPart.Position.Z-(ShieldSize/2))
107
		MainLocation:findFirstChild("weinershield").left.Size = Vector3.new(1,ShieldSize,ShieldSize)
108
		MainLocation:findFirstChild("weinershield").left.CFrame = CFrame.new(followPart.Position.X+(ShieldSize/2), followPart.Position.Y, followPart.Position.Z)
109
		MainLocation:findFirstChild("weinershield").right.Size = Vector3.new(1,ShieldSize,ShieldSize)
110
		MainLocation:findFirstChild("weinershield").right.CFrame = CFrame.new(followPart.Position.X-(ShieldSize/2), followPart.Position.Y, followPart.Position.Z)
111
		MainLocation:findFirstChild("weinershield").top.Size = Vector3.new(ShieldSize,1,ShieldSize)
112
		MainLocation:findFirstChild("weinershield").top.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y+(ShieldSize/2), followPart.Position.Z)
113
		MainLocation:findFirstChild("weinershield").bottom.Size = Vector3.new(ShieldSize,1,ShieldSize)
114
		MainLocation:findFirstChild("weinershield").bottom.CFrame = CFrame.new(followPart.Position.X, followPart.Position.Y-(ShieldSize/2), followPart.Position.Z)
115
	end)
116
end
117
118
119
local function CreateRegion3FromLocAndSize(Position, Size)
120
	local SizeOffset = Size/2
121
	local Point1 = Position - SizeOffset
122
	local Point2 = Position + SizeOffset
123
	return Region3.new(Point1, Point2)
124
end
125
126
createShield()
127
game:GetService("RunService").Heartbeat:connect(function()
128
	if not scriptBreak then
129
		local me = game:GetService("Players").LocalPlayer
130
		local char = workspace:findFirstChild(me.Name)
131
		actualList = {}
132
		for i,v in pairs(playerList) do
133
			pcall(function()
134
				table.insert(actualList, workspace:findFirstChild(v.Name))
135
			end)
136
		end
137
		if MainLocation:findFirstChild("weinershield") ~= nil then
138
			updateShield()
139
		else
140
			createShield()
141
		end
142
		pcall(function()
143
			local Region = CreateRegion3FromLocAndSize(followPart.Position, Vector3.new(ShieldSize+1,ShieldSize+1,ShieldSize+1))
144
			for _,Part in pairs(workspace:FindPartsInRegion3WithIgnoreList(Region,actualList,math.huge)) do
145
				if Part.Name ~= "Base" and not Part:isDescendantOf(MainLocation:findFirstChild("weinershield")) then
146
					Part:Destroy()
147
				end
148
			end
149
		end)
150
		pcall(function()
151
			for i,v in pairs(actualList) do
152
				if v:findFirstChild("Humanoid") ~= nil then
153
					v.Humanoid.MaxHealth = math.huge
154
					v.Humanoid.Health = math.huge
155
				else
156
					Instance.new("Humanoid", v)
157
				end
158
			end
159
		end)
160
	end
161
end)