View difference between Paste ID: zyyPqiXe and Z2s0T5wM
SHOW: | | - or go back to the newest paste.
1
-- developed by elite_doge, 1,11,2015, 5:18 PM
2
 
3
local enableKey = "e" -- what key you need to press to teleport
4
 
5
6
7-
local p = game.Players.LocalPlayer
7+
-- This script has been converted to FE by iPxter
8-
local mouse = p:GetMouse()
8+
9
10
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
11
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
12
do
13
	print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
14
	script.Parent = Player.Character
15
16
	--RemoteEvent for communicating
17
	local Event = Instance.new("RemoteEvent")
18
	Event.Name = "UserInput_Event"
19
20
	--Fake event to make stuff like Mouse.KeyDown work
21
	local function fakeEvent()
22
		local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
23
		t.connect = t.Connect
24
		return t
25
	end
26
27
	--Creating fake input objects with fake variables
28
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
29
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
30
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
31
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
32
	end}
33
	--Merged 2 functions into one by checking amount of arguments
34
	CAS.UnbindAction = CAS.BindAction
35
36
	--This function will trigger the events that have been :Connect()'ed
37
	local function te(self,ev,...)
38
		local t = m[ev]
39
		if t and t._fakeEvent and t.Function then
40
			t.Function(...)
41
		end
42
	end
43
	m.TrigEvent = te
44
	UIS.TrigEvent = te
45
46
	Event.OnServerEvent:Connect(function(plr,io)
47
	    if plr~=Player then return end
48
		if io.isMouse then
49
			m.Target = io.Target
50
			m.Hit = io.Hit
51
		else
52
			local b = io.UserInputState == Enum.UserInputState.Begin
53
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
54
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
55
			end
56
			for _,t in pairs(CAS.Actions) do
57
				for _,k in pairs(t.Keys) do
58
					if k==io.KeyCode then
59
						t.Function(t.Name,io.UserInputState,io)
60
					end
61
				end
62
			end
63
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
64
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
65
	    end
66
	end)
67
	Event.Parent = NLS([==[
68
	local Player = game:GetService("Players").LocalPlayer
69
	local Event = script:WaitForChild("UserInput_Event")
70
71
	local UIS = game:GetService("UserInputService")
72
	local input = function(io,a)
73
		if a then return end
74
		--Since InputObject is a client-side instance, we create and pass table instead
75
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
76
	end
77
	UIS.InputBegan:Connect(input)
78
	UIS.InputEnded:Connect(input)
79
80
	local Mouse = Player:GetMouse()
81
	local h,t
82
	--Give the server mouse data 30 times every second, but only if the values changed
83
	--If player is not moving their mouse, client won't fire events
84
	while wait(1/30) do
85
		if h~=Mouse.Hit or t~=Mouse.Target then
86
			h,t=Mouse.Hit,Mouse.Target
87
			Event:FireServer({isMouse=true,Target=t,Hit=h})
88
		end
89
	end]==],Player.Character)
90
	Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
91
end
92
93
94
95
------------------------------------
96
-- getting needed locals
97
local p = owner
98
local char = p.Character
99
-- creating gui creation functions
100
function setProperties(gui,t)
101
    gui.BackgroundColor3 = Color3.new(0,0,0)
102
    gui.BackgroundTransparency = t
103
    gui.BorderSizePixel = 0
104
end
105
 
106
function setText(gui,te)
107
    gui.TextStrokeTransparency = 0
108
    gui.TextStrokeColor3 = Color3.new(255,255,255)
109
    gui.TextColor3 = Color3.new(0,0,0)
110
    gui.Text = te
111
    gui.TextScaled = true
112
    gui.TextXAlignment = Enum.TextXAlignment.Center
113
end
114
--- creating gui
115
local gui = Instance.new("ScreenGui",p.PlayerGui)
116
gui.Name = "TeleportationInfo"
117
local f = Instance.new("Frame",gui)
118
f.Size = UDim2.new(0.2,0,0.4,0)
119
f.Position = UDim2.new(1,0,0.3,0)
120
setProperties(f,0.5)
121
local open = Instance.new("TextButton",gui)
122
open.Name = "Open"
123
setProperties(open,0.5)
124
setText(open,"Tele Help")
125
open.Size = UDim2.new(0.1,0,0.05,0)
126
open.Position = UDim2.new(1 - open.Size.X.Scale,0,0.5,0)
127
local text = Instance.new("TextLabel",f)
128
text.Name = "Text"
129
setProperties(text,1)
130
text.Size = UDim2.new(1,0,0.8,0)
131
setText(text,"Hold 'e' and click where you want to teleport. Click on this gui to close.")
132
local name = "elite_doge"
133
local text2  = text:Clone()
134
text2.Parent = text.Parent
135
text2.Size = UDim2.new(1,0,0.2,0)
136
text2.Position = UDim2.new(0,0,0.8,0)
137
text2.Name = "Creator"
138
local isOpen = false
139
local close = Instance.new("TextButton",f)
140
close.Name = "Close"
141
text2.Text = "Developed by " .. name.. ", 1/11/2015"
142
setProperties(close,1)
143
close.Visible = false
144
close.Text = ""
145
close.Size = UDim2.new(1,0,1,0)
146
-- creating gui functions
147
close.MouseButton1Down:connect(function()
148
    if isOpen == true then
149
        f:TweenPosition(UDim2.new(1,0,0.3,0),"InOut","Quad",1,true)
150
        open:TweenPosition(UDim2.new(1 - open.Size.X.Scale,0,0.5,0),"InOut","Quad",1,true)
151
        isOpen = false
152
        close.Visible = false
153
    else
154
        close.Visible = false
155
        open:TweenPosition(UDim2.new(1,0,0.5,0),"InOut","Quad",1,true)
156
    end
157
end)
158
 
159
open.MouseButton1Down:connect(function()
160
    if isOpen == false then
161
        isOpen = true
162
        f:TweenPosition(UDim2.new(1 - f.Size.X.Scale,0,0.3,0),"InOut","Quad",1,true)
163
        open:TweenPosition(UDim2.new(1,0,0.5,0),"InOut","Quad",1,true)
164
        close.Visible = true
165
    end
166
end)
167
-- click and keydown functions
168
local enabled = false
169
 
170
mouse.KeyDown:connect(function(key)
171
    key = key:lower()
172
    if key == "e" then
173
        enabled = true
174
    end
175
end)
176
 
177
mouse.KeyUp:connect(function(key)
178
    key = key:lower()
179
    if key == "e" then
180
        enabled = false
181
    end
182
end)
183
 
184
mouse.Button1Down:connect(function()
185
    if char and enabled == true then
186
        char.HumanoidRootPart.CFrame = mouse.Hit + Vector3.new(0,7,0)
187
    end
188
end)