tomoneko

背後テレポート

Oct 4th, 2023 (edited)
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | Gaming | 0 0
  1. local Players = game:GetService("Players")
  2. local teleportingPlayer = Players.LocalPlayer
  3. local teleportEnabled = false
  4. local targetPlayerName = ""
  5.  
  6. local screenGui = Instance.new("ScreenGui")
  7. screenGui.Parent = teleportingPlayer:WaitForChild("PlayerGui")
  8.  
  9. local button = Instance.new("TextButton")
  10. button.Parent = screenGui
  11. button.Size = UDim2.new(0, 150, 0, 65)
  12. button.Position = UDim2.new(0.5, -75, 0.1, 0)
  13. button.Text = "友猫作"
  14. button.TextSize = 22
  15. button.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  16.  
  17. local playerListFrame = Instance.new("ScrollingFrame")
  18. playerListFrame.Parent = screenGui
  19. playerListFrame.Size = UDim2.new(0, 150, 0, 200)
  20. playerListFrame.Position = UDim2.new(0.5, 75, 0.1, 0)
  21.  
  22. local function updatePlayerList()
  23. for _, child in ipairs(playerListFrame:GetChildren()) do
  24. child:Destroy()
  25. end
  26. for i, player in ipairs(Players:GetPlayers()) do
  27. local button = Instance.new("TextButton")
  28. button.Parent = playerListFrame
  29. button.Size = UDim2.new(1, 0, 0, 30)
  30. button.Position = UDim2.new(0, 0, (i - 1) / #Players:GetPlayers(), 0)
  31. button.Text = player.Name
  32. button.MouseButton1Click:Connect(function()
  33. targetPlayerName = player.Name
  34. end)
  35. end
  36. end
  37.  
  38. updatePlayerList()
  39. Players.PlayerAdded:Connect(updatePlayerList)
  40. Players.PlayerRemoving:Connect(updatePlayerList)
  41.  
  42. button.MouseButton1Click:Connect(function()
  43. teleportEnabled = not teleportEnabled
  44. if not teleportEnabled then
  45. targetPlayerName = ""
  46. end
  47. button.Text = teleportEnabled and "オン" or "オフ"
  48. button.BackgroundColor3 = teleportEnabled and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
  49. end)
  50.  
  51. local closeButton = Instance.new("TextButton")
  52. closeButton.Parent = screenGui
  53. closeButton.Size = UDim2.new(0, 20, 0, 20)
  54. closeButton.Position = UDim2.new(1, -40, 0, 10)
  55. closeButton.Text = "閉じる"
  56. closeButton.TextSize = 10
  57. closeButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  58.  
  59. local isGuiVisible = true
  60. closeButton.MouseButton1Click:Connect(function()
  61. isGuiVisible = not isGuiVisible
  62. button.Visible = isGuiVisible
  63. playerListFrame.Visible = isGuiVisible
  64. end)
  65.  
  66. teleportingPlayer.CharacterAdded:Connect(function(character)
  67. character:WaitForChild('Humanoid').Died:Connect(function()
  68. teleportEnabled=false;
  69. button.Text="オフ";
  70. button.BackgroundColor3=Color3.fromRGB(255,0,0);
  71. end)
  72. end)
  73.  
  74. while wait(0.1) do
  75. if teleportEnabled then
  76. local player
  77. for _, p in ipairs(Players:GetPlayers()) do
  78. if p.Name == targetPlayerName or p.DisplayName == targetPlayerName then
  79. player = p
  80. break
  81. end
  82. end
  83.  
  84. if player and player.Character and player.Character:FindFirstChild("HumanoidRootPart") and teleportingPlayer.Character and teleportingPlayer.Character:FindFirstChild("HumanoidRootPart") then
  85. local teleportPosition = player.Character.HumanoidRootPart.Position - player.Character.HumanoidRootPart.CFrame.LookVector * 3 + player.Character.HumanoidRootPart.CFrame.RightVector * 2
  86. local teleportDirection = player.Character.HumanoidRootPart.CFrame.LookVector
  87. teleportingPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(teleportPosition, teleportPosition + teleportDirection)
  88. end
  89. end
  90. end
  91.  
Advertisement
Add Comment
Please, Sign In to add comment