Advertisement
MayWeEnjoy

bring tsb

Nov 2nd, 2024 (edited)
3,256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.97 KB | None | 0 0
  1. -- Variables
  2. local player = game.Players.LocalPlayer
  3. local teleportDuration = 2
  4. local gui
  5.  
  6. -- Function to create the GUI
  7. local function createGUI()
  8. -- Create ScreenGui and MainFrame
  9. gui = Instance.new("ScreenGui")
  10. gui.Name = "TeleportGUI"
  11. gui.ResetOnSpawn = false -- Ensures GUI stays after death
  12. gui.Parent = player:WaitForChild("PlayerGui")
  13.  
  14. local mainFrame = Instance.new("Frame")
  15. mainFrame.Size = UDim2.new(0, 200, 0, 150)
  16. mainFrame.Position = UDim2.new(0.5, -100, 0.5, -75)
  17. mainFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 255) -- Blue
  18. mainFrame.Active = true
  19. mainFrame.Draggable = true
  20. mainFrame.Parent = gui
  21.  
  22. -- Close Button (Red 'X')
  23. local closeButton = Instance.new("TextButton")
  24. closeButton.Size = UDim2.new(0, 20, 0, 20)
  25. closeButton.Position = UDim2.new(1, -25, 0, 5)
  26. closeButton.Text = "X"
  27. closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  28. closeButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red
  29. closeButton.Parent = mainFrame
  30.  
  31. -- Minimize Button (Dark Blue '-')
  32. local minimizeButton = Instance.new("TextButton")
  33. minimizeButton.Size = UDim2.new(0, 20, 0, 20)
  34. minimizeButton.Position = UDim2.new(1, -50, 0, 5)
  35. minimizeButton.Text = "-"
  36. minimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  37. minimizeButton.BackgroundColor3 = Color3.fromRGB(0, 0, 128) -- Dark Blue
  38. minimizeButton.Parent = mainFrame
  39.  
  40. -- Hidden "Open" Button
  41. local openButton = Instance.new("TextButton")
  42. openButton.Size = UDim2.new(0, 50, 0, 20)
  43. openButton.Position = UDim2.new(1, -55, 0, 5)
  44. openButton.Text = "Open"
  45. openButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  46. openButton.BackgroundColor3 = Color3.fromRGB(0, 0, 255) -- Blue
  47. openButton.Visible = false
  48. openButton.Active = true
  49. openButton.Draggable = true
  50. openButton.Parent = gui
  51.  
  52. -- Small Text "Bring TSBG" (Black)
  53. local bringLabel = Instance.new("TextLabel")
  54. bringLabel.Size = UDim2.new(0, 60, 0, 20)
  55. bringLabel.Position = UDim2.new(0, 5, 0, 5)
  56. bringLabel.Text = "Bring TSBG"
  57. bringLabel.TextSize = 8
  58. bringLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
  59. bringLabel.BackgroundTransparency = 1
  60. bringLabel.Parent = mainFrame
  61.  
  62. -- TextBox for Username/Displayname Input (Dark Blue)
  63. local targetTextBox = Instance.new("TextBox")
  64. targetTextBox.Size = UDim2.new(0.8, 0, 0, 30)
  65. targetTextBox.Position = UDim2.new(0.1, 0, 0.4, 0)
  66. targetTextBox.PlaceholderText = "Enter Username/Displayname"
  67. targetTextBox.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
  68. targetTextBox.BackgroundColor3 = Color3.fromRGB(0, 0, 128) -- Dark Blue
  69. targetTextBox.Parent = mainFrame
  70.  
  71. -- Bring Button (Dark Blue)
  72. local bringButton = Instance.new("TextButton")
  73. bringButton.Size = UDim2.new(0.8, 0, 0, 30)
  74. bringButton.Position = UDim2.new(0.1, 0, 0.7, 0)
  75. bringButton.Text = "Bring"
  76. bringButton.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
  77. bringButton.BackgroundColor3 = Color3.fromRGB(0, 0, 128) -- Dark Blue
  78. bringButton.Parent = mainFrame
  79.  
  80. -- Footer Text "by Pyst" (Black)
  81. local footerLabel = Instance.new("TextLabel")
  82. footerLabel.Size = UDim2.new(0, 50, 0, 20)
  83. footerLabel.Position = UDim2.new(0, 5, 1, -25)
  84. footerLabel.Text = "by Pyst"
  85. footerLabel.TextSize = 8
  86. footerLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
  87. footerLabel.BackgroundTransparency = 1
  88. footerLabel.Parent = mainFrame
  89.  
  90. -- Function to equip the first tool that is in the hotbar (under the screen)
  91. local function equipFirstHotbarTool()
  92. -- The first tool equipped in the hotbar is the tool that the player has selected
  93. local hotbarTool = player.Character and player.Character:FindFirstChildOfClass("Tool")
  94. if hotbarTool then
  95. hotbarTool.Parent = player.Character
  96. end
  97. end
  98.  
  99. -- Button Functionality
  100. closeButton.MouseButton1Click:Connect(function()
  101. gui:Destroy()
  102. end)
  103.  
  104. minimizeButton.MouseButton1Click:Connect(function()
  105. mainFrame.Visible = false
  106. openButton.Visible = true
  107. end)
  108.  
  109. openButton.MouseButton1Click:Connect(function()
  110. mainFrame.Visible = true
  111. openButton.Visible = false
  112. end)
  113.  
  114. bringButton.MouseButton1Click:Connect(function()
  115. local targetName = targetTextBox.Text
  116. if targetName == "" then return end
  117.  
  118. -- Equip the first tool that is in the hotbar (the tool under the screen)
  119. equipFirstHotbarTool()
  120.  
  121. -- Find target by partial username or display name
  122. local targetPlayer
  123. for _, p in pairs(game.Players:GetPlayers()) do
  124. if string.find(p.Name:lower(), targetName:lower()) or string.find(p.DisplayName:lower(), targetName:lower()) then
  125. targetPlayer = p
  126. break
  127. end
  128. end
  129.  
  130. if targetPlayer then
  131. local targetChar = targetPlayer.Character
  132. local myChar = player.Character
  133. if targetChar and myChar then
  134. local myPosition = myChar.PrimaryPart.Position -- Store original position
  135.  
  136. -- Follow behind target
  137. local followConnection
  138. followConnection = game:GetService("RunService").RenderStepped:Connect(function()
  139. if not targetChar or not myChar then
  140. followConnection:Disconnect()
  141. return
  142. end
  143. myChar:SetPrimaryPartCFrame(targetChar.PrimaryPart.CFrame * CFrame.new(0, 0, 3))
  144. end)
  145.  
  146. -- Stop following after the specified duration
  147. wait(teleportDuration)
  148. followConnection:Disconnect()
  149. myChar:SetPrimaryPartCFrame(CFrame.new(myPosition)) -- Return to original position
  150. end
  151. end
  152. end)
  153. end
  154.  
  155. -- Initialize the GUI
  156. createGUI()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement