View difference between Paste ID: ZV5ywyEP and TLhZtkP2
SHOW: | | - or go back to the newest paste.
1
if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility by WaverlyCole & Fireboltofdeath");print("https://github.com/WaverlyCole/FE-Compatibility-VoidSb-")
2
local Wrapper = {};Wrapper.Fake = {};Wrapper.Real = {};Wrapper.Data = {};
3
local sGame = game;local sScript = script;local sOwner = owner;local sInstance = Instance;local sLoadLibrary = LoadLibrary
4
Wrapper.Event = Instance.new("RemoteEvent");Wrapper.Event.Name = "UserInput";
5
Wrapper.CreateObject = function(connections, index)
6
    local proxy = newproxy (true);local meta = getmetatable (proxy);
7
    local runbind = function (self, i, ...) connections[i]:Fire (...); end;
8
	while (#connections > 0) do connections[table.remove(connections, 1)] = Instance.new ('BindableEvent');end;
9
    meta.__index = function (self, i)
10
        if (i == 'TriggerEvent') then return runbind end;
11
        return connections[i] and connections[i].Event or index[i];
12
    end;
13
    meta.__newindex = index;meta.__metatable = false;return proxy
14
end;
15
Wrapper.Mouse = Wrapper.CreateObject({"KeyUp","KeyDown","Button1Down","Button1Up","Move","Button2Down","Button2Up"},{["Target"] = nil;["Hit"] = CFrame.new()})
16
Wrapper.UserInputService = Wrapper.CreateObject({"InputBegan","InputEnded"},{})
17
Wrapper.ContextActionService = {Actions={};BindAction = function(self,actionName,Func,touch,...)self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil end;UnBindAction = function(self,actionName,Func,touch,...)self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil end};
18
Wrapper.Sandbox = function(...)
19
  local Unwrap = {...};
20
  for obi = 1,#Unwrap do
21
    local Object = Unwrap[obi];
22
    if (Wrapper.Fake[Object] == nil and Wrapper.Real[Object] == nil) then
23
      local Type = typeof(Object);local Replacement = Object;
24
      if (Type == "function") then
25
		Replacement = function(...)
26
			local IsRoblox = not (pcall(function() string.dump(Object) end))
27
			if IsRoblox then
28
				return Object(Wrapper.Unsandbox(...))
29
			end
30
			return Object(Wrapper.Sandbox(...))
31
		end
32
	  elseif (Type == "table") then
33
		Replacement = {};
34
        setmetatable(Replacement, {
35
        	__index = function(self, i)
36
            	return Wrapper.Sandbox(Object[Wrapper.Unsandbox(i)])
37
        	end,
38
			__newindex = function(self,i,v)
39
				Object[Wrapper.Unsandbox(i)] = Wrapper.Unsandbox(v)
40
			end;
41
       })
42
      elseif (Type == "Instance") then
43
        Replacement = newproxy(true);
44
        local Mt = getmetatable(Replacement);
45
		Mt.__namecall = function(self, ...)
46
            local Pack = {...};local Name = Pack[#Pack];table.remove(Pack, #Pack);
47
            local Rest = nil;pcall(function()Rest = Object[Name];end);
48
            for g, x in pairs (Wrapper.InstanceMT["GET"]) do
49
                if (Object:IsA(g) or g == "Global") then
50
                    for t, v in pairs(x) do
51
                        for str in string.gmatch(t .. ",", "(%w+),")  do
52
                            if (Name == str) then
53
								if typeof(v) == "function" then
54
									return Wrapper.Sandbox(v(Wrapper.Unsandbox(self), Wrapper.Unsandbox(unpack(Pack))))
55
                                else
56
                                    return v;
57
								end
58
                            end
59
                        end
60
                    end
61
                end
62
            end
63
            if (Rest == nil) then
64
				if Wrapper.Sandbox(sGame):GetService(unpack(Pack)) then return Wrapper.Sandbox(sGame):GetService(unpack(Pack))end;
65
                return Wrapper.Sandbox(Object[Name]);
66
            elseif (typeof(Rest) == "function") then
67
                return Wrapper.Sandbox(Rest(Wrapper.Unsandbox(self), Wrapper.Unsandbox(unpack(Pack))))
68
            end
69
          	return Wrapper.Sandbox(Object[Name]);
70
        end
71
        Mt.__index = function(self, i)
72
			local Rest = nil;pcall(function()Rest = Object[i];end)
73
            for g, x in pairs (Wrapper.InstanceMT["GET"]) do
74
                if (Object:IsA(g) or g == "Global") then
75
                    for t, v in pairs(x) do
76
                        for str in string.gmatch(t .. ",", "(%w+),")  do
77
                            if (i == str) then
78
								if typeof(v) == "function" then
79
									return function(...)return Wrapper.Sandbox(v(Wrapper.Unsandbox(self), Wrapper.Unsandbox(...)))end;
80
                                else
81
                                    return v;
82
								end
83
                            end
84
                        end
85
                    end
86
                end
87
            end
88
			if (Object:IsA("Sound") and i == "PlaybackLoudness") then return Wrapper.SoundLoudness[Wrapper.Unsandbox(Object)];end;
89
            if (Rest == nil) then
90
				if Wrapper.Sandbox(sGame):GetService(i) then return Wrapper.Sandbox(sGame):GetService(i)end;
91
                return Wrapper.Sandbox(Object[i]);
92
            elseif (typeof(Rest) == "function") then
93
				local isService,Service = pcall(function() return sGame:GetService(i) end)
94
				if isService and Service then return Wrapper.Sandbox(Service) end
95
                return function(self, ...)
96
                    return Wrapper.Sandbox(Rest(Wrapper.Unsandbox(self), Wrapper.Unsandbox(...)))
97
                end
98
            end
99
          	return Wrapper.Sandbox(Object[i]);
100
        end
101
		Mt.__newindex = function(self, i, v)
102
			for g,x in pairs (Wrapper.InstanceMT["SET"]) do 
103
				if (Object:IsA(g)) then
104
					for t, v in pairs(x) do 
105
						for str in string.gmatch( t .. ",", "(%w+),") do 
106
							if v(Wrapper.Unsandbox(self, i, v)) == true then
107
								Object[Wrapper.Unsandbox(i)] = Wrapper.Unsandbox(v);return
108
							end
109
						end
110
					end
111
				end
112
			end
113
			Object[Wrapper.Unsandbox(i)] = Wrapper.Unsandbox(v);
114
        end
115
        Mt.__tostring = function(self) return tostring(Object) end
116
      --elseif (Type == "") then -- Etc
117
      end
118
      Wrapper.Fake[Object] = Replacement;Wrapper.Real[Replacement] = Object;Unwrap[obi] = Replacement;
119
    else
120
      return Wrapper.Fake[Object] or Object;
121
    end
122
  end
123
  return unpack(Unwrap);
124
end
125
Wrapper.Unsandbox = function(...)
126
  local Unsandbox = {...};
127
  for i,v in pairs (Unsandbox) do Unsandbox[i] = Wrapper.Real[v] or Unsandbox[i]end;
128
  return unpack(Unsandbox)
129
end
130
Wrapper.Services = {
131
	['contextactionservice'] = Wrapper.ContextActionService;
132
	["userinputservice"]  = Wrapper.UserInputService;
133
}
134
Wrapper.InstanceMT = { 
135
    ["GET"] = {
136
		["Global"] = {
137
			["IsFake,isFake"] = function(self)return true;end;
138
		};
139
        ["Player"] = {
140
			["mouse,Mouse,getMouse,GetMouse"] = function(self)return Wrapper.Mouse;end;
141
        };
142
        ["Players"] = {
143
            ["localPlayer,LocalPlayer"] = Wrapper.Sandbox(owner)
144
        };
145
		["DataModel"] = {
146
			["getService,GetService"] = function(self,service)
147
				if Wrapper.Services[service:lower()] then return Wrapper.Sandbox(Wrapper.Services[service:lower()])end;
148
				return Wrapper.Sandbox(sGame:GetService(service))
149
			end
150
		};
151
		["RunService"] = {
152
            ["renderstepped,renderStepped,RenderStepped"] =  sGame:GetService("RunService").Stepped;
153
        }
154
  };
155
    ["SET"] = {
156
  }
157
}
158
Wrapper.SoundLoudness = {};
159
Wrapper.Event.OnServerEvent:Connect(function(FiredBy,Input)
160
	if FiredBy ~= sOwner then return end
161
	if Input.MouseEvent then
162
		Wrapper.Mouse.Target = Input.Target;Wrapper.Mouse.Hit = Input.Hit;Wrapper.Mouse:TriggerEvent("Move")
163
	elseif Input.Sound then
164
		if Wrapper.SoundLoudness[Input.Sound] then Wrapper.SoundLoudness[Input.Sound] = Input.Loudness end
165
	else
166
		local Begin = Input.UserInputState == Enum.UserInputState.Begin
167
		if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Wrapper.Mouse:TriggerEvent(Begin and "Button1Down" or "Button1Up") end
168
		if Input.UserInputType == Enum.UserInputType.MouseButton2 then return Wrapper.Mouse:TriggerEvent(Begin and "Button2Down" or "Button2Up") end
169
		for _,Action in pairs(Wrapper.ContextActionService.Actions) do
170
			for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
171
		end
172
		Wrapper.Mouse:TriggerEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower());Wrapper.UserInputService:TriggerEvent(Begin and "InputBegan" or "InputEnded",Input,false)
173
	end
174
end);
175
Wrapper.Event.Parent = NLS([[
176
		local Player = owner;local Sounds = {};local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse();
177
		local Input = function(Input,gameProcessedEvent)
178
			if gameProcessedEvent then return end;
179
			Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
180
		end
181
		Event.OnClientEvent:connect(function(Args)
182
			if Args[1] == "NewSound" and Args[2]:IsA("Sound") then table.insert(Sounds,Args[2]) end
183
		end)
184
		UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
185
		local Hit,Target;while wait(1/30) do
186
			for x,Sound in pairs(Sounds) do if Sound.Parent then Event:FireServer({["Sound"]=Sound,["Loudness"]=Sound.PlaybackLoudness}) end; end;
187
			if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
188
				Hit = Mouse.Hit;Target = Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
189
			end
190
		end]],sOwner.Character)
191
Instance = {
192
	["new"] = function(Type,Parent)
193
		local Real = sInstance.new(Type,Wrapper.Unsandbox(Parent))
194
		if Type:lower() == "sound" then
195
			if not Parent then
196
				Parent = sOwner.Character 
197
			end 
198
			Wrapper.SoundLoudness[Real] = 0;Wrapper.Event:FireClient(sOwner,{"NewSound",Real})
199
		end
200
		return Wrapper.Sandbox(Real)
201
	end
202
}
203
LoadLibrary = function(Library)
204
	if Library == "RbxUtility" then
205
		return setmetatable({},{
206
			__tostring = function() return "RbxUtility" end;
207
			__index = function(self, Index)
208
				if Index:lower() == "create" then
209
					return function(Type) return function(Data)
210
							Data = Data or {};local Inst = Instance.new(Type)
211
							for x,y in pairs(Data) do Inst[x] = y end
212
							return Inst
213
					end;end;
214
				end
215
			return sLoadLibrary(Library)[Index]
216
		end})
217
	end
218
	return sLoadLibrary(Library)
219
end
220
owner = Wrapper.Sandbox(owner);game = Wrapper.Sandbox(game)workspace = Wrapper.Sandbox(workspace)
221
Game= game;Workspace = workspace;
222
223
224
--By Rufus14, works on r6 aswell on r15 (WORKS ON EVERY SERVER), press z to die (RUN AS LOCAL)
225
character = game:GetService("Players").LocalPlayer.Character
226
humanoid = character:findFirstChildOfClass("Humanoid")
227
mouse = game:GetService("Players").LocalPlayer:GetMouse()
228
canuncollide = true
229
function die()
230
	print("dead")
231
	local rootcframe = character.HumanoidRootPart.CFrame
232
	local deadsign = Instance.new("BoolValue", character)
233
	deadsign.Name = "ImDead"
234
	character.HumanoidRootPart:destroy()
235
	for i,v in pairs(character:GetChildren()) do
236
		if v.ClassName == "MeshPart" or v.ClassName == "Part" then
237
			local position = Instance.new("CFrameValue", v)
238
			position.Name = "LimbPosition"
239
			position.Value = v.CFrame
240
		end
241
	end
242
	if character:findFirstChild("UpperTorso") then
243
		wait(1)
244
	elseif character:findFirstChild("Torso") then
245
		wait(3)
246
	end
247
	local function uncollide()
248
		while game:GetService("RunService").Stepped:wait() and canuncollide do
249
			if canuncollide then
250
				if character:findFirstChild("Torso") then
251
					character.Torso.CanCollide = false
252
				end
253
			end
254
		end
255
	end
256
	for i,v in pairs(character:GetChildren()) do
257
		if v.ClassName == "MeshPart" or v.ClassName == "Part" and v:findFirstChild("LimbPosition") then
258
			local gyro = Instance.new("BodyGyro", v)
259
			gyro.CFrame = v.LimbPosition.Value
260
			if v.Name == "Torso" then
261
				spawn(uncollide)
262
			end
263
			for i = 0,0.7 , 0.08 do
264
				v.CFrame = v.CFrame:lerp(v.LimbPosition.Value, i)
265
				game:GetService("RunService").RenderStepped:wait()
266
			end
267
			local bodypos = Instance.new("BodyPosition", v)
268
			bodypos.Position = v.LimbPosition.Value.p
269
			bodypos.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
270
		end
271
	end
272
	while game:GetService("Players").LocalPlayer.Character:findFirstChild("ImDead") do
273
		game:GetService("RunService").RenderStepped:wait()
274
	end
275
	canuncollide = false
276
	print("teleporting")
277
	game:GetService("Players").LocalPlayer.Character:WaitForChild("HumanoidRootPart")
278
	if game:GetService("Players").LocalPlayer.Character:findFirstChild("ForceField") then
279
		game:GetService("Players").LocalPlayer.Character:findFirstChild("ForceField"):destroy()
280
	end
281
	for i = 1,8 do
282
		game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = rootcframe
283
		wait()
284
	end
285
end
286
function press(key)
287
	key = key:lower()
288
	if key == "z" and canuncollide then
289
		humanoid.Health = 0
290
	end
291
end
292
mouse.KeyDown:connect(press)
293
humanoid.Died:connect(die)