View difference between Paste ID: WZHtdc4G and TLhZtkP2
SHOW: | | - or go back to the newest paste.
1
--By Rufus14, works on r6 aswell on r15 (WORKS ON EVERY SERVER), press z to die (RUN AS LOCAL)
2
3
if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility: by WaverlyCole");InternalData = {}
4
do
5
	script.Parent = owner.Character
6
	local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
7
	local function NewFakeEvent()
8
		local Bind = Instance.new("BindableEvent")
9
		local Fake;Fake = {Connections = {},
10
		fakeEvent=true;
11
		Connect=function(self,Func)
12
			Bind.Event:connect(Func)
13
			self.Connections[Bind] = true
14
			return setmetatable({Connected = true},{
15
			__index = function (self,Index)
16
				if Index:lower() == "disconnect" then
17
					return function() Fake.Connections[Bind] = false;self.Connected = false end
18
				end
19
				return Fake[Index]
20
			end;
21
			__tostring = function() return "Connection" end;
22
		})
23
		end}
24
		Fake.connect = Fake.Connect;return Fake;
25
	end
26
	local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
27
	local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
28
	local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
29
		self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
30
	end};ContextActionService.UnBindAction = ContextActionService.BindAction
31
	local function TriggerEvent(self,Event,...)
32
		local Trigger = Mouse[Event]
33
		if Trigger and Trigger.fakeEvent and Trigger.Connections then
34
			for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
35
		end
36
	end
37
	Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
38
	Event.OnServerEvent:Connect(function(FiredBy,Input)
39
		if FiredBy.Name ~= owner.Name then return end
40
		if Input.MouseEvent then
41
			Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
42
		else
43
			local Begin = Input.UserInputState == Enum.UserInputState.Begin
44
			if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
45
			for _,Action in pairs(ContextActionService.Actions) do
46
				for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
47
			end
48
			Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
49
			UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
50
		end
51
	end)
52
	InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
53
	Event.Parent = NLS([[
54
		local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
55
		local Input = function(Input,gameProcessedEvent)
56
			if gameProcessedEvent then return end
57
			Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
58
		end
59
		UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
60
		local Hit,Target
61
		while wait(1/30) do
62
			if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
63
				Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
64
			end
65
		end
66
	]],owner.Character)
67
end
68
RealGame = game;game = setmetatable({},{
69
	__index = function (self,Index)
70
		local Sandbox = function (Thing)
71
			if Thing:IsA("Player") then
72
				local RealPlayer = Thing
73
				return setmetatable({},{
74
					__index = function (self,Index)
75
						local Type = type(RealPlayer[Index])
76
						if Type == "function" then
77
							if Index:lower() == "getmouse" or Index:lower() == "mouse" then
78
								return function (self)return InternalData["Mouse"] end
79
							end
80
							return function (self,...)return RealPlayer[Index](RealPlayer,...) end
81
						end
82
						return RealPlayer[Index]
83
					end;
84
					__tostring = function(self) return RealPlayer.Name end
85
				})
86
			end
87
		end
88
		if RealGame[Index] then
89
			local Type = type(RealGame[Index])
90
			if Type == "function" then
91
				if Index:lower() == "getservice" or Index:lower() == "service" then
92
					return function (self,Service)
93
						local FakeServices = {
94
							["players"] = function()
95
								return setmetatable({},{
96
									__index = function (self2,Index2)
97
										local RealService = RealGame:GetService(Service)
98
										local Type2 = type(Index2)
99
										if Type2 == "function" then
100
											return function (self,...) return RealService[Index2](RealService,...)end
101
										else
102
											if Index2:lower() == "localplayer" then return Sandbox(owner) end
103
											return RealService[Index2]
104
										end
105
									end;
106
									__tostring = function(self) return RealGame:GetService(Service).Name end
107
								})
108
							end;
109
							["contextactionservice"] = function() return InternalData["ContextActionService"] end;
110
							["userinputservice"] = function() return InternalData["UserInputService"] end;
111
							["runservice"] = function()
112
								return setmetatable({},{
113
									__index = function(self2,Index2)
114
										local RealService = RealGame:GetService(Service)
115
										local Type2 = type(Index2)
116
										if Type2 == "function" then
117
											return function (self,...) return RealService[Index2](RealService,...) end
118
										else
119
											local RunServices = {
120
												["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
121
												["renderstepped"] = function() return RealService["Stepped"] end
122
											}
123
											if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
124
											return RealService[Index2]
125
										end
126
									end
127
								})
128
							end
129
						}
130
						if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
131
						return RealGame:GetService(Service)
132
					end
133
				end
134
				return function (self,...) return RealGame[Index](RealGame,...) end
135
			else
136
				if game:GetService(Index) then return game:GetService(Index) end
137
				return RealGame[Index]
138
			end
139
		end
140
		return nil
141
	end
142
});Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
143
144
145
character = game:GetService("Players").LocalPlayer.Character
146
humanoid = character:findFirstChildOfClass("Humanoid")
147
mouse = game:GetService("Players").LocalPlayer:GetMouse()
148
canuncollide = true
149
function die()
150
	print("dead")
151
	local rootcframe = character.HumanoidRootPart.CFrame
152
	local deadsign = Instance.new("BoolValue", character)
153
	deadsign.Name = "ImDead"
154
	character.HumanoidRootPart:destroy()
155
	for i,v in pairs(character:GetChildren()) do
156
		if v.ClassName == "MeshPart" or v.ClassName == "Part" then
157
			local position = Instance.new("CFrameValue", v)
158
			position.Name = "LimbPosition"
159
			position.Value = v.CFrame
160
		end
161
	end
162
	if character:findFirstChild("UpperTorso") then
163
		wait(1)
164
	elseif character:findFirstChild("Torso") then
165
		wait(3)
166
	end
167
	local function uncollide()
168
		while game:GetService("RunService").Stepped:wait() and canuncollide do
169
			if canuncollide then
170
				if character:findFirstChild("Torso") then
171
					character.Torso.CanCollide = false
172
				end
173
			end
174
		end
175
	end
176
	for i,v in pairs(character:GetChildren()) do
177
		if v.ClassName == "MeshPart" or v.ClassName == "Part" and v:findFirstChild("LimbPosition") then
178
			local gyro = Instance.new("BodyGyro", v)
179
			gyro.CFrame = v.LimbPosition.Value
180
			if v.Name == "Torso" then
181
				spawn(uncollide)
182
			end
183
			for i = 0,0.7 , 0.08 do
184
				v.CFrame = v.CFrame:lerp(v.LimbPosition.Value, i)
185
				game:GetService("RunService").RenderStepped:wait()
186
			end
187
			local bodypos = Instance.new("BodyPosition", v)
188
			bodypos.Position = v.LimbPosition.Value.p
189
			bodypos.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
190
		end
191
	end
192
	while game:GetService("Players").LocalPlayer.Character:findFirstChild("ImDead") do
193
		game:GetService("RunService").RenderStepped:wait()
194
	end
195
	canuncollide = false
196
	print("teleporting")
197
	game:GetService("Players").LocalPlayer.Character:WaitForChild("HumanoidRootPart")
198
	if game:GetService("Players").LocalPlayer.Character:findFirstChild("ForceField") then
199
		game:GetService("Players").LocalPlayer.Character:findFirstChild("ForceField"):destroy()
200
	end
201
	for i = 1,8 do
202
		game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = rootcframe
203
		wait()
204
	end
205
end
206
function press(key)
207
	key = key:lower()
208
	if key == "z" and canuncollide then
209
		humanoid.Health = 0
210
	end
211
end
212
mouse.KeyDown:connect(press)
213
humanoid.Died:connect(die)