View difference between Paste ID: SnXUd9FF and 6CMcGxei
SHOW: | | - or go back to the newest paste.
1-
-- LocalScript inside StarterPlayerScripts
1+
-- TELEPORT GUI V3 FIXED WITH POSITION UPDATE
2
3
local player = game.Players.LocalPlayer
4-
local character = player.Character or player.CharacterAdded:Wait()
4+
local Players = game:GetService("Players")
5-
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
5+
local UserInputService = game:GetService("UserInputService")
6
local RunService = game:GetService("RunService")
7-
-- Create the part under the player
7+
local mouse = player:GetMouse()
8-
local followPart = Instance.new("Part")
8+
9-
followPart.Size = Vector3.new(4, 1, 4) -- size of the part
9+
-- Variables
10-
followPart.Anchored = true
10+
local dragEnabled = true
11-
followPart.CanCollide = true
11+
local dragging = false
12-
followPart.Material = Enum.Material.Neon
12+
local dragStart, startPos
13-
followPart.Color = Color3.fromRGB(0, 255, 0)
13+
local tpMouseEnabled = false
14-
followPart.Transparency = 0.5
14+
15-
followPart.Parent = workspace
15+
-- GUI
16
local gui = Instance.new("ScreenGui")
17-
-- Function to update part's position under the player
17+
gui.Name = "TeleportGUI"
18-
local function updatePart()
18+
gui.ResetOnSpawn = false
19-
    if character and humanoidRootPart then
19+
gui.Parent = player:WaitForChild("PlayerGui")
20-
        followPart.Position = humanoidRootPart.Position - Vector3.new(0, humanoidRootPart.Size.Y/2 + followPart.Size.Y/2, 0)
20+
21-
    end
21+
-- MAIN FRAME
22
local frame = Instance.new("Frame")
23
frame.Size = UDim2.new(0,350,0,500)
24-
-- Toggle collision switch
24+
frame.Position = UDim2.new(1,-360,0.5,-250)
25-
local toggle = true
25+
frame.BackgroundColor3 = Color3.fromRGB(160,0,200)
26
frame.BorderSizePixel = 0
27-
-- Create a GUI button for toggle
27+
frame.Parent = gui
28-
local screenGui = Instance.new("ScreenGui")
28+
29-
screenGui.Parent = player:WaitForChild("PlayerGui")
29+
-- TOP BAR
30
local topBar = Instance.new("Frame")
31-
local toggleButton = Instance.new("TextButton")
31+
topBar.Size = UDim2.new(1,0,0,30)
32-
toggleButton.Size = UDim2.new(0, 100, 0, 50)
32+
topBar.BackgroundColor3 = Color3.fromRGB(120,0,160)
33-
toggleButton.Position = UDim2.new(1, -110, 0.5, -25) -- right side
33+
topBar.Parent = frame
34-
toggleButton.Text = "Toggle Collision"
34+
35-
toggleButton.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
35+
local title = Instance.new("TextLabel")
36-
toggleButton.TextColor3 = Color3.new(1,1,1)
36+
title.Size = UDim2.new(1,0,1,0)
37-
toggleButton.Parent = screenGui
37+
title.BackgroundTransparency = 1
38
title.Text = "Teleport GUI"
39-
toggleButton.MouseButton1Click:Connect(function()
39+
title.TextScaled = true
40-
    toggle = not toggle
40+
title.TextColor3 = Color3.new(1,1,1)
41-
    followPart.CanCollide = toggle
41+
title.Parent = topBar
42-
    if toggle then
42+
43-
        followPart.Color = Color3.fromRGB(0,255,0)
43+
-- INNER
44-
    else
44+
local inner = Instance.new("Frame")
45-
        followPart.Color = Color3.fromRGB(255,0,0)
45+
inner.Size = UDim2.new(1,-10,1,-40)
46-
    end
46+
inner.Position = UDim2.new(0,5,0,35)
47
inner.BackgroundColor3 = Color3.fromRGB(30,30,30)
48
inner.Parent = frame
49-
-- Update loop
49+
50-
game:GetService("RunService").RenderStepped:Connect(updatePart)
50+
-- POSITION LABEL
51
local posLabel = Instance.new("TextLabel")
52
posLabel.Size = UDim2.new(1,-20,0,30)
53
posLabel.Position = UDim2.new(0,10,0,5)
54
posLabel.BackgroundTransparency = 1
55
posLabel.TextScaled = true
56
posLabel.TextColor3 = Color3.new(1,1,1)
57
posLabel.Text = "Position: 0,0,0"
58
posLabel.Parent = inner
59
60
-- GOTO POSITION
61
local gotoPosBox = Instance.new("TextBox")
62
gotoPosBox.Size = UDim2.new(1,-20,0,35)
63
gotoPosBox.Position = UDim2.new(0,10,0,40)
64
gotoPosBox.PlaceholderText = "Goto Position (x,y,z)"
65
gotoPosBox.TextScaled = true
66
gotoPosBox.BackgroundColor3 = Color3.fromRGB(70,70,255)
67
gotoPosBox.TextColor3 = Color3.new(1,1,1)
68
gotoPosBox.Parent = inner
69
70
local gotoPosButton = Instance.new("TextButton")
71
gotoPosButton.Size = UDim2.new(1,-20,0,35)
72
gotoPosButton.Position = UDim2.new(0,10,0,80)
73
gotoPosButton.Text = "Teleport to Position"
74
gotoPosButton.TextScaled = true
75
gotoPosButton.BackgroundColor3 = Color3.fromRGB(0,200,100)
76
gotoPosButton.TextColor3 = Color3.new(1,1,1)
77
gotoPosButton.Parent = inner
78
79
-- GOTO PLAYER
80
local gotoPlayerBox = Instance.new("TextBox")
81
gotoPlayerBox.Size = UDim2.new(0.7,0,0,35)
82
gotoPlayerBox.Position = UDim2.new(0,10,0,120)
83
gotoPlayerBox.PlaceholderText = "Goto Player"
84
gotoPlayerBox.TextScaled = true
85
gotoPlayerBox.BackgroundColor3 = Color3.fromRGB(70,70,255)
86
gotoPlayerBox.TextColor3 = Color3.new(1,1,1)
87
gotoPlayerBox.Parent = inner
88
89
local gotoPlayerButton = Instance.new("TextButton")
90
gotoPlayerButton.Size = UDim2.new(0.28,0,0,35)
91
gotoPlayerButton.Position = UDim2.new(0.72,0,0,120)
92
gotoPlayerButton.Text = "Teleport"
93
gotoPlayerButton.TextScaled = true
94
gotoPlayerButton.BackgroundColor3 = Color3.fromRGB(0,200,100)
95
gotoPlayerButton.TextColor3 = Color3.new(1,1,1)
96
gotoPlayerButton.Parent = inner
97
98
-- COPY POSITION
99
local copyButton = Instance.new("TextButton")
100
copyButton.Size = UDim2.new(1,-20,0,35)
101
copyButton.Position = UDim2.new(0,10,0,160)
102
copyButton.Text = "Copy Position"
103
copyButton.TextScaled = true
104
copyButton.BackgroundColor3 = Color3.fromRGB(0,150,255)
105
copyButton.TextColor3 = Color3.new(1,1,1)
106
copyButton.Parent = inner
107
108
-- DRAG TOGGLE
109
local dragButton = Instance.new("TextButton")
110
dragButton.Size = UDim2.new(1,-20,0,35)
111
dragButton.Position = UDim2.new(0,10,0,200)
112
dragButton.Text = "Drag GUI: ON"
113
dragButton.TextScaled = true
114
dragButton.BackgroundColor3 = Color3.fromRGB(0,200,0)
115
dragButton.TextColor3 = Color3.new(1,1,1)
116
dragButton.Parent = inner
117
118
-- TP TO MOUSE
119
local mouseButton = Instance.new("TextButton")
120
mouseButton.Size = UDim2.new(1,-20,0,35)
121
mouseButton.Position = UDim2.new(0,10,0,240)
122
mouseButton.Text = "TP To Mouse: OFF"
123
mouseButton.TextScaled = true
124
mouseButton.BackgroundColor3 = Color3.fromRGB(255,0,100)
125
mouseButton.TextColor3 = Color3.new(1,1,1)
126
mouseButton.Parent = inner
127
128
-- RECENT TELEPORTS BUTTON
129
local recentButton = Instance.new("TextButton")
130
recentButton.Size = UDim2.new(1,-20,0,35)
131
recentButton.Position = UDim2.new(0,10,0,280)
132
recentButton.Text = "Show Recent Teleports"
133
recentButton.TextScaled = true
134
recentButton.BackgroundColor3 = Color3.fromRGB(200,0,255)
135
recentButton.TextColor3 = Color3.new(1,1,1)
136
recentButton.Parent = inner
137
138
-- PLAYER LIST BUTTON
139
local playerListButton = Instance.new("TextButton")
140
playerListButton.Size = UDim2.new(1,-20,0,35)
141
playerListButton.Position = UDim2.new(0,10,0,320)
142
playerListButton.Text = "Show Player List"
143
playerListButton.TextScaled = true
144
playerListButton.BackgroundColor3 = Color3.fromRGB(100,200,255)
145
playerListButton.TextColor3 = Color3.new(1,1,1)
146
playerListButton.Parent = inner
147
148
-- DESTROY GUI
149
local destroyButton = Instance.new("TextButton")
150
destroyButton.Size = UDim2.new(1,-20,0,35)
151
destroyButton.Position = UDim2.new(0,10,0,360)
152
destroyButton.Text = "Destroy GUI"
153
destroyButton.TextScaled = true
154
destroyButton.BackgroundColor3 = Color3.fromRGB(255,70,70)
155
destroyButton.TextColor3 = Color3.new(1,1,1)
156
destroyButton.Parent = inner
157
158
-- ====================
159
-- RECENT TELEPORTS GUI
160
-- ====================
161
local recentGui = Instance.new("Frame")
162
recentGui.Size = UDim2.new(0,500,0,400)
163
recentGui.Position = UDim2.new(0.5,-250,0.5,-200)
164
recentGui.BackgroundColor3 = Color3.fromRGB(50,50,50)
165
recentGui.Visible = false
166
recentGui.Parent = gui
167
168
local recentScroll = Instance.new("ScrollingFrame")
169
recentScroll.Size = UDim2.new(1,-10,1,-10)
170
recentScroll.Position = UDim2.new(0,5,0,5)
171
recentScroll.BackgroundTransparency = 1
172
recentScroll.ScrollBarThickness = 10
173
recentScroll.Parent = recentGui
174
175
local recentLayout = Instance.new("UIListLayout")
176
recentLayout.Padding = UDim.new(0,5)
177
recentLayout.Parent = recentScroll
178
179
-- ====================
180
-- PLAYER LIST GUI
181
-- ====================
182
local listGui = Instance.new("Frame")
183
listGui.Size = UDim2.new(0,500,0,400)
184
listGui.Position = UDim2.new(0.5,-250,0.5,-200)
185
listGui.BackgroundColor3 = Color3.fromRGB(70,70,70)
186
listGui.Visible = false
187
listGui.Parent = gui
188
189
local listScroll = Instance.new("ScrollingFrame")
190
listScroll.Size = UDim2.new(1,-10,1,-10)
191
listScroll.Position = UDim2.new(0,5,0,5)
192
listScroll.BackgroundTransparency = 1
193
listScroll.ScrollBarThickness = 10
194
listScroll.Parent = listGui
195
196
local listLayout = Instance.new("UIListLayout")
197
listLayout.Padding = UDim.new(0,5)
198
listLayout.Parent = listScroll
199
200
-- ====================
201
-- FUNCTIONS
202
-- ====================
203
204
-- Drag toggle
205
dragButton.MouseButton1Click:Connect(function()
206
	dragEnabled = not dragEnabled
207
	dragButton.Text = dragEnabled and "Drag GUI: ON" or "Drag GUI: OFF"
208
	dragButton.BackgroundColor3 = dragEnabled and Color3.fromRGB(0,200,0) or Color3.fromRGB(200,0,0)
209
end)
210
211
-- Drag logic
212
topBar.InputBegan:Connect(function(input)
213
	if (input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch) and dragEnabled then
214
		dragging = true
215
		dragStart = input.Position
216
		startPos = frame.Position
217
		input.Changed:Connect(function()
218
			if input.UserInputState==Enum.UserInputState.End then dragging=false end
219
		end)
220
	end
221
end)
222
223
topBar.InputChanged:Connect(function(input)
224
	if dragging and (input.UserInputType==Enum.UserInputType.MouseMovement or input.UserInputType==Enum.UserInputType.Touch) then
225
		local delta = input.Position - dragStart
226
		frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset+delta.X, startPos.Y.Scale, startPos.Y.Offset+delta.Y)
227
	end
228
end)
229
230
-- TP Mouse
231
mouseButton.MouseButton1Click:Connect(function()
232
	tpMouseEnabled = not tpMouseEnabled
233
	mouseButton.Text = tpMouseEnabled and "TP To Mouse: ON" or "TP To Mouse: OFF"
234
	mouseButton.BackgroundColor3 = tpMouseEnabled and Color3.fromRGB(0,200,0) or Color3.fromRGB(255,0,100)
235
end)
236
237
mouse.Button1Down:Connect(function()
238
	if tpMouseEnabled and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
239
		local targetPos = mouse.Hit.Position + Vector3.new(0,5,0)
240
		player.Character.HumanoidRootPart.CFrame = CFrame.new(targetPos)
241
	end
242
end)
243
244
-- Copy position
245
copyButton.MouseButton1Click:Connect(function()
246
	if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
247
		local pos = player.Character.HumanoidRootPart.Position
248
		local text = math.floor(pos.X)..","..math.floor(pos.Y)..","..math.floor(pos.Z)
249
		gotoPosBox.Text = text
250
		pcall(function() setclipboard(text) end)
251
	end
252
end)
253
254
-- Teleport position
255
gotoPosButton.MouseButton1Click:Connect(function()
256
	local coords = string.split(gotoPosBox.Text,",")
257
	if #coords==3 then
258
		local x,y,z = tonumber(coords[1]),tonumber(coords[2]),tonumber(coords[3])
259
		if x and y and z and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
260
			local pos = Vector3.new(x,y,z)
261
			player.Character.HumanoidRootPart.CFrame = CFrame.new(pos)
262
			
263
			-- Add recent
264
			local entry = Instance.new("Frame")
265
			entry.Size = UDim2.new(1,-10,0,50)
266
			entry.BackgroundColor3 = Color3.fromRGB(100,100,255)
267
			entry.Parent = recentScroll
268
269
			local label = Instance.new("TextLabel")
270
			label.Size = UDim2.new(0.75,0,1,0)
271
			label.Position = UDim2.new(0,5,0,0)
272
			label.BackgroundTransparency = 1
273
			label.TextScaled = true
274
			label.TextColor3 = Color3.new(1,1,1)
275
			label.Text = math.floor(pos.X)..","..math.floor(pos.Y)..","..math.floor(pos.Z)
276
			label.Parent = entry
277
278
			local tp = Instance.new("TextButton")
279
			tp.Size = UDim2.new(0.25,-5,1,0)
280
			tp.Position = UDim2.new(0.75,0,0,0)
281
			tp.Text = "TP"
282
			tp.TextScaled = true
283
			tp.BackgroundColor3 = Color3.fromRGB(0,200,100)
284
			tp.TextColor3 = Color3.new(1,1,1)
285
			tp.Parent = entry
286
287
			tp.MouseButton1Click:Connect(function()
288
				if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
289
					player.Character.HumanoidRootPart.CFrame = CFrame.new(pos)
290
				end
291
			end)
292
293
			recentScroll.CanvasSize = UDim2.new(0,0,0,recentLayout.AbsoluteContentSize.Y)
294
		end
295
	end
296
end)
297
298
-- Show/hide middle GUIs
299
recentButton.MouseButton1Click:Connect(function()
300
	recentGui.Visible = not recentGui.Visible
301
	if recentGui.Visible then listGui.Visible = false end
302
end)
303
304
playerListButton.MouseButton1Click:Connect(function()
305
	listGui.Visible = not listGui.Visible
306
	if listGui.Visible then recentGui.Visible = false end
307
end)
308
309
-- Player list update
310
local function updatePlayerList()
311
	for _,v in pairs(listScroll:GetChildren()) do
312
		if v:IsA("Frame") then v:Destroy() end
313
	end
314
315
	for _,p in pairs(Players:GetPlayers()) do
316
		local entry = Instance.new("Frame")
317
		entry.Size = UDim2.new(1,-10,0,50)
318
		entry.BackgroundColor3 = Color3.fromRGB(100,150,200)
319
		entry.Parent = listScroll
320
321
		local label = Instance.new("TextLabel")
322
		label.Size = UDim2.new(0.75,0,1,0)
323
		label.Position = UDim2.new(0,5,0,0)
324
		label.BackgroundTransparency = 1
325
		label.TextScaled = true
326
		label.TextColor3 = Color3.new(1,1,1)
327
		label.Text = p.Name.." | "..p.DisplayName
328
		label.Parent = entry
329
330
		local tp = Instance.new("TextButton")
331
		tp.Size = UDim2.new(0.25,-5,1,0)
332
		tp.Position = UDim2.new(0.75,0,0,0)
333
		tp.Text = "TP"
334
		tp.TextScaled = true
335
		tp.BackgroundColor3 = Color3.fromRGB(0,200,100)
336
		tp.TextColor3 = Color3.new(1,1,1)
337
		tp.Parent = entry
338
339
		tp.MouseButton1Click:Connect(function()
340
			if p.Character and p.Character:FindFirstChild("HumanoidRootPart") and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
341
				player.Character.HumanoidRootPart.CFrame = p.Character.HumanoidRootPart.CFrame
342
			end
343
		end)
344
	end
345
346
	listScroll.CanvasSize = UDim2.new(0,0,0,listLayout.AbsoluteContentSize.Y)
347
end
348
349
Players.PlayerAdded:Connect(updatePlayerList)
350
Players.PlayerRemoving:Connect(updatePlayerList)
351
updatePlayerList()
352
353
-- Teleport to player
354
gotoPlayerButton.MouseButton1Click:Connect(function()
355
	local text = gotoPlayerBox.Text:lower()
356
	for _,p in pairs(Players:GetPlayers()) do
357
		if (p.Name:lower():sub(1,#text) == text or p.DisplayName:lower():sub(1,#text) == text) and p.Character and p.Character:FindFirstChild("HumanoidRootPart") and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
358
			player.Character.HumanoidRootPart.CFrame = p.Character.HumanoidRootPart.CFrame
359
			break
360
		end
361
	end
362
end)
363
364
-- Autocomplete
365
gotoPlayerBox.FocusLost:Connect(function()
366
	local input = gotoPlayerBox.Text:lower()
367
	for _,p in pairs(Players:GetPlayers()) do
368
		if p.Name:lower():sub(1,#input) == input or p.DisplayName:lower():sub(1,#input) == input then
369
			gotoPlayerBox.Text = p.Name
370
			break
371
		end
372
	end
373
end)
374
375
-- Destroy GUI
376
destroyButton.MouseButton1Click:Connect(function()
377
	gui:Destroy()
378
end)
379
380
-- ====================
381
-- REAL-TIME POSITION UPDATE
382
-- ====================
383
RunService.RenderStepped:Connect(function()
384
	if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
385
		local pos = player.Character.HumanoidRootPart.Position
386
		posLabel.Text = string.format("Position: %d, %d, %d", math.floor(pos.X), math.floor(pos.Y), math.floor(pos.Z))
387
	end
388
end)