View difference between Paste ID: Wq1VFHH2 and ttH9CWwY
SHOW: | | - or go back to the newest paste.
1
-- This script has been converted to FE by iPxter
2
3
4
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
5
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
6
do
7
	print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
8
	script.Parent = Player.Character
9
10
	--RemoteEvent for communicating
11
	local Event = Instance.new("RemoteEvent")
12
	Event.Name = "UserInput_Event"
13
14
	--Fake event to make stuff like Mouse.KeyDown work
15
	local function fakeEvent()
16
		local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
17
		t.connect = t.Connect
18
		return t
19-
if script.ClassName=="Script"then
19+
20-
if game:GetService("RunService"):IsClient() then error("Please run as a server script. Use h/ instead of hl/.") end
20+
21-
print("FE Compatibility: by WaverlyCole & Mokiros")
21+
	--Creating fake input objects with fake variables
22-
InternalData = {}
22+
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
23
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
24-
	script.Parent = owner.Character
24+
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
25
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
26-
	Event.Name = "UserInput"
26+
	end}
27-
	local function NewFakeEvent()
27+
	--Merged 2 functions into one by checking amount of arguments
28-
		local Fake = {fakeEvent=true,Connect=function(self,Func)self.Function=Func end}Fake.connect = Fake.Connect
28+
	CAS.UnbindAction = CAS.BindAction
29-
		return Fake
29+
30
	--This function will trigger the events that have been :Connect()'ed
31-
	local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
31+
	local function te(self,ev,...)
32-
	local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
32+
		local t = m[ev]
33-
	local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
33+
		if t and t._fakeEvent and t.Function then
34-
		self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
34+
			t.Function(...)
35-
	end};ContextActionService.UnBindAction = ContextActionService.BindAction
35+
36-
	local function TriggerEvent(self,Event,...)
36+
37-
		local Trigger = Mouse[Event]
37+
	m.TrigEvent = te
38-
		if Trigger and Trigger.fakeEvent and Trigger.Function then
38+
	UIS.TrigEvent = te
39-
			Trigger.Function(...)
39+
40
	Event.OnServerEvent:Connect(function(plr,io)
41
	    if plr~=Player then return end
42-
	Mouse.TrigEvent = TriggerEvent
42+
		if io.isMouse then
43-
	UserInputService.TrigEvent = TriggerEvent
43+
			m.Target = io.Target
44-
	Event.OnServerEvent:Connect(function(FiredBy,Input)
44+
			m.Hit = io.Hit
45-
		if FiredBy.Name ~= owner.Name then end
45+
46-
		if Input.MouseEvent then
46+
			local b = io.UserInputState == Enum.UserInputState.Begin
47-
			Mouse.Target = Input.Target
47+
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
48-
			Mouse.Hit = Input.Hit
48+
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
49
			end
50-
			local Begin = Input.UserInputState == Enum.UserInputState.Begin
50+
			for _,t in pairs(CAS.Actions) do
51-
			if Input.UserInputType == Enum.UserInputType.MouseButton1 then
51+
				for _,k in pairs(t.Keys) do
52-
				return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up")
52+
					if k==io.KeyCode then
53
						t.Function(t.Name,io.UserInputState,io)
54-
			for _,Action in pairs(ContextActionService.Actions) do
54+
55-
				for _,Key in pairs(Action.Keys) do
55+
56-
					if Key==Input.KeyCode then
56+
57-
						Action.Function(Action.Name,Input.UserInputState,Input)
57+
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
58
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
59
	    end
60
	end)
61-
			Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
61+
	Event.Parent = NLS([==[
62-
			UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
62+
	local Player = owner
63
	local Event = script:WaitForChild("UserInput_Event")
64
65-
	InternalData["Mouse"] = Mouse
65+
	local UIS = game:GetService("UserInputService")
66-
	InternalData["ContextActionService"] = ContextActionService
66+
	local input = function(io,a)
67-
	InternalData["UserInputService"] = UserInputService
67+
		if a then return end
68-
	Event.Parent = NLS([[
68+
		--Since InputObject is a client-side instance, we create and pass table instead
69-
		local Player = owner
69+
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
70-
		local Event = script:WaitForChild("UserInput")
70+
71-
		local UserInputService = game:GetService("UserInputService")
71+
	UIS.InputBegan:Connect(input)
72-
		local Mouse = Player:GetMouse()
72+
	UIS.InputEnded:Connect(input)
73-
		local Input = function(Input,gameProcessedEvent)
73+
74-
			if gameProcessedEvent then return end
74+
	local Mouse = Player:GetMouse()
75-
			Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
75+
	local h,t
76
	--Give the server mouse data 30 times every second, but only if the values changed
77-
		UserInputService.InputBegan:Connect(Input)
77+
	--If player is not moving their mouse, client won't fire events
78-
		UserInputService.InputEnded:Connect(Input)
78+
	while wait(1/30) do
79-
		local Hit,Target
79+
		if h~=Mouse.Hit or t~=Mouse.Target then
80-
		while wait(1/30) do
80+
			h,t=Mouse.Hit,Mouse.Target
81-
			if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
81+
			Event:FireServer({isMouse=true,Target=t,Hit=h})
82-
				Hit,Target = Mouse.Hit,Mouse.Target
82+
83-
				Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
83+
	end]==],Player.Character)
84
	Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
85
end
86-
	]],owner.Character)
86+
87
--[[
88-
RealGame = game;game = setmetatable({},{
88+
89-
	__index = function (self,Index)
89+
90-
		local Sandbox = function (Thing)
90+
91-
			if Thing:IsA("Player") then
91+
92-
				local RealPlayer = Thing
92+
93-
				return setmetatable({},{
93+
94-
					__index = function (self,Index)
94+
95-
						local Type = type(RealPlayer[Index])
95+
96-
						if Type == "function" then
96+
97-
							if Index:lower() == "getmouse" or Index:lower() == "mouse" then
97+
98-
								return function (self)
98+
99-
									return InternalData["Mouse"]
99+
100-
								end
100+
101-
							end
101+
102-
							return function (self,...)
102+
103-
								return RealPlayer[Index](RealPlayer,...)
103+
104-
							end
104+
105-
						else
105+
106-
							if Index == "PlrObj" then
106+
107-
								return RealPlayer
107+
108-
							end
108+
109-
							return RealPlayer[Index]
109+
110-
						end
110+
111-
					end;
111+
PL=owner if PL.Character then PC=PL.Character
112-
					__tostring = function(self)
112+
113-
						return RealPlayer.Name
113+
114
	local b=Instance.new("TextLabel",a)b.Size=UDim2.new(1,0,0,30)b.BackgroundTransparency=1 b.TextStrokeTransparency=1 b.TextTransparency=1 b.TextColor3=Color3.new(1,1,1)b.Text=text b.TextScaled=false b.TextSize=20
115-
				})
115+
	spawn(function()for i=1,10,.2 do b.Position=UDim2.new(0,0,1,-i*15-60)b.TextTransparency=i/10 b.TextStrokeTransparency=i/10 wait()end a:Remove()end)
116
end
117
local nb=Instance.new("BillboardGui",PC.Head)nb.Size=UDim2.new(0,50,0,50)nb.ExtentsOffsetWorldSpace=Vector3.new(0,5,0)--nb.AlwaysOnTop=true
118-
		if RealGame[Index] then
118+
119-
			local Type = type(RealGame[Index])
119+
120-
			if Type == "function" then
120+
121-
				if Index:lower() == "getservice" or Index:lower() == "service" then
121+
122-
					return function (self,Service)
122+
123-
						if Service:lower() == "players" then
123+
124-
							return setmetatable({},{
124+
125-
								__index = function (self2,Index2)
125+
126-
									local RealService = RealGame:GetService(Service)
126+
127-
									local Type2 = type(Index2)
127+
128-
									if Type2 == "function" then
128+
129-
										return function (self,...)
129+
130-
											return RealService[Index2](RealService,...)
130+
131-
										end
131+
132-
									else
132+
133-
										if Index2:lower() == "localplayer" then
133+
game:GetService("UserInputService").InputBegan:connect(function(Key, Gpe)
134-
											return Sandbox(owner)
134+
	if not Gpe then	
135-
										end
135+
		if Key.KeyCode==Enum.KeyCode.Seven then
136-
										return RealService[Index2]
136+
137-
									end
137+
138-
								end;
138+
139-
								__tostring = function(self)
139+
140-
									return RealGame:GetService(Service).Name
140+
141-
								end
141+
142-
							})
142+
143-
						elseif Service:lower() == "contextactionservice" then
143+
144-
							return InternalData["ContextActionService"]
144+
145-
						elseif Service:lower() == "contextactionservice" then
145+
		if Key.KeyCode==Enum.KeyCode.Six then
146-
							return InternalData["UserInputService"]
146+
147-
						elseif Service:lower() == "runservice" then
147+
148-
							return setmetatable({},{
148+
149-
								__index = function(self2,Index2)
149+
				sidk("Projectile Speed:Normal")
150-
									local RealService = RealGame:GetService(Service)
150+
151-
									local Type2 = type(Index2)
151+
152-
									if Type2 == "function" then
152+
				sidk("Projectile Speed:Reverse")
153-
										return function (self,...)
153+
154-
											return RealService[Index2](RealService,...)
154+
155-
										end
155+
		if Key.KeyCode==Enum.KeyCode.Five then
156-
									else
156+
157-
										if Index2:lower() == "bindtorenderstep" then
157+
158-
											return function (self,Name,Priority,Function)
158+
159-
												return RealGame:GetService("RunService").Stepped:Connect(Function)
159+
				sidk("Work to Humanoid:Disabled")
160-
											end
160+
161-
										end
161+
162-
										if Index2:lower() == "renderstepped" then
162+
163-
											return RealService["Stepped"]
163+
164-
										end
164+
165-
										return RealService[Index2]
165+
166-
									end
166+
167-
								end
167+
168-
							})
168+
169-
						else
169+
170-
							return RealGame:GetService(Service)
170+
171-
						end
171+
172
t.InputEnded:connect(function(m)idk5(t.Text)t.Text="Put number here(Changes speed)"end)end end end)