Advertisement
MaxproGlitcher

Menu pour se teleporter a un joueur en TweenService

Sep 3rd, 2023 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.07 KB | None | 0 0
  1. game:GetService("StarterGui"):SetCore("SendNotification",{
  2. Title = "Tp au joueurs",
  3. Text = "Script a été executer",
  4. Icon = "rbxassetid://14682078456",
  5. Duration = 15
  6. })
  7.  
  8. game:GetService("StarterGui"):SetCore("SendNotification",{
  9. Title = "Version 1.0",
  10. Text = "Script a été executer",
  11. Icon = "rbxassetid://14682078456",
  12. Duration = 15
  13. })
  14.  
  15. task.spawn(function()
  16. local beep = Instance.new("Sound");
  17. beep.Volume = 1; -- de 0 à 1, vous pouvez en faire plus mais ce sera bruyant
  18. beep.SoundId = "rbxassetid://232127604";
  19. beep.Parent = game:GetService("CoreGui");
  20. beep:Play();
  21. beep.Ended:Wait();
  22. beep:Destroy();
  23. end)
  24.  
  25. print ("Le menu a été activer , tout les joueurs de la game se mettras a jour tout le long de la game ")
  26.  
  27. print("Merci de utiliser mon script!!!!")
  28.  
  29. local player = game.Players.LocalPlayer
  30. local TweenService = game:GetService("TweenService")
  31.  
  32. -- Créer un ScreenGui pour contenir la liste des lecteurs personnalisés
  33. local playerListGui = Instance.new("ScreenGui")
  34. playerListGui.Parent = game.CoreGui
  35. playerListGui.Enabled = true -- Initialement, l'interface graphique est activée
  36.  
  37. -- Créer un cadre pour l'arrière-plan
  38. local backgroundFrame = Instance.new("Frame")
  39. backgroundFrame.Parent = playerListGui
  40. backgroundFrame.Size = UDim2.new(0, 200, 0, 400)
  41. backgroundFrame.Position = UDim2.new(1, -200, 0, 0) -- Coin supérieur droit
  42. backgroundFrame.BackgroundColor3 = Color3.new(0, 0, 0)
  43. backgroundFrame.BackgroundTransparency = 0.5 -- 50% la transparence
  44. backgroundFrame.BorderSizePixel = 0
  45.  
  46. -- Créer un TextLabel pour le nombre de joueurs
  47. local playerCountLabel = Instance.new("TextLabel")
  48. playerCountLabel.Parent = backgroundFrame
  49. playerCountLabel.Size = UDim2.new(1, 0, 0, 30)
  50. playerCountLabel.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  51. playerCountLabel.BorderSizePixel = 0
  52. playerCountLabel.Text = "Players: " .. #game.Players:GetPlayers()
  53. playerCountLabel.TextSize = 18
  54. playerCountLabel.TextColor3 = Color3.new(1, 1, 1)
  55.  
  56. -- Créer un ScrollingFrame pour contenir la liste des joueurs
  57. local playerListFrame = Instance.new("ScrollingFrame")
  58. playerListFrame.Parent = backgroundFrame
  59. playerListFrame.Size = UDim2.new(1, 0, 1, -30)
  60. playerListFrame.Position = UDim2.new(0, 0, 0, 30)
  61. playerListFrame.BackgroundTransparency = 1 -- La rendre totalement transparente
  62. playerListFrame.ScrollBarThickness = 5
  63.  
  64. -- Créer un UIListLayout pour organiser les étiquettes verticalement
  65. local listLayout = Instance.new("UIListLayout")
  66. listLayout.Parent = playerListFrame
  67. listLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  68. listLayout.VerticalAlignment = Enum.VerticalAlignment.Top
  69. listLayout.SortOrder = Enum.SortOrder.LayoutOrder
  70.  
  71. -- Fonction permettant de créer un TextButton pour chaque joueur avec des animations de survol et de clic.
  72. local function createPlayerButton(playerName)
  73. local button = Instance.new("TextButton")
  74. button.Parent = playerListFrame
  75. button.Size = UDim2.new(1, 0, 0, 30)
  76. button.BackgroundColor3 = Color3.new(197, 0, 0) -- Couleur de fond bleue
  77. button.BackgroundTransparency = 0.5 -- 50% de transparence
  78. button.BorderSizePixel = 0
  79. button.Text = playerName
  80. button.TextSize = 18
  81. button.TextColor3 = Color3.new(1, 1, 1)
  82.  
  83. -- Effet de survol
  84. local defaultColor = button.BackgroundColor3
  85. local hoverColor = Color3.new(0.15, 0.6, 1) -- Bleu plus clair au survol
  86.  
  87. button.MouseEnter:Connect(function()
  88. button:TweenSize(UDim2.new(1, 0, 0, 40), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
  89. button.BackgroundColor3 = hoverColor
  90. end)
  91.  
  92. button.MouseLeave:Connect(function()
  93. button:TweenSize(UDim2.new(1, 0, 0, 30), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
  94. button.BackgroundColor3 = defaultColor
  95. end)
  96.  
  97. -- Téléportation du lecteur local vers le lecteur sélectionné à l'aide d'un tweening
  98. button.MouseButton1Click:Connect(function()
  99. local targetPlayer = game.Players:FindFirstChild(playerName)
  100. if targetPlayer then
  101. local targetCharacter = targetPlayer.Character
  102. if targetCharacter then
  103. local targetHumanoidRootPart = targetCharacter:FindFirstChild("HumanoidRootPart")
  104. if targetHumanoidRootPart then
  105. local teleportDestination = targetHumanoidRootPart.Position + Vector3.new(0, 5, 0)
  106. local playerCharacter = player.Character
  107. if playerCharacter then
  108. local playerHumanoidRootPart = playerCharacter:FindFirstChild("HumanoidRootPart")
  109. if playerHumanoidRootPart then
  110. local tweenInfo = TweenInfo.new(
  111. 1, -- Duration
  112. Enum.EasingStyle.Quad, -- Un style apaisé
  113. Enum.EasingDirection.Out -- Assouplir la direction
  114. )
  115. local targetCFrame = CFrame.new(teleportDestination)
  116. local tween = TweenService:Create(playerHumanoidRootPart, tweenInfo, {CFrame = targetCFrame})
  117. tween:Play()
  118. end
  119. end
  120. end
  121. end
  122. end
  123. end)
  124. end
  125.  
  126. -- Fonction permettant de mettre à jour la liste des joueurs et d'ajuster la taille de l'interface graphique
  127. local function updatePlayerList()
  128. local players = game.Players:GetPlayers()
  129. local numPlayers = #players
  130. local guiHeight = math.max(numPlayers * 40, 400) -- Hauteur minimale de 400
  131.  
  132. -- Mise à jour de l'étiquette du nombre de joueurs
  133. playerCountLabel.Text = "Players: " .. numPlayers
  134.  
  135. -- Effacer la liste des joueurs
  136. for _, child in pairs(playerListFrame:GetChildren()) do
  137. if child:IsA("TextButton") then
  138. child:Destroy()
  139. end
  140. end
  141.  
  142. --Créer un TextButton pour chaque joueur du serveur
  143. for _, playerObj in ipairs(players) do
  144. if playerObj ~= player then
  145. createPlayerButton(playerObj.Name)
  146. end
  147. end
  148.  
  149. -- Ajuster la taille de l'arrière-plan à la liste mise à jour
  150. backgroundFrame.Size = UDim2.new(0, 200, 0, guiHeight + 30)
  151. end
  152.  
  153. -- Première mise à jour de la liste des joueurs
  154. updatePlayerList()
  155.  
  156. -- Se connecter aux événements d'ajout et de départ de joueurs pour mettre à jour la liste des joueurs.
  157. game.Players.PlayerAdded:Connect(updatePlayerList)
  158. game.Players.PlayerRemoving:Connect(updatePlayerList)
  159.  
  160. -- Fonction permettant d'activer et de désactiver la visibilité de l'interface graphique à l'aide de la touche "T
  161. local function toggleGUIVisibility()
  162. playerListGui.Enabled = not playerListGui.Enabled
  163. end
  164.  
  165. -- Écouter la pression de la touche "T
  166. game:GetService("UserInputService").InputBegan:Connect(function(input)
  167. if input.KeyCode == Enum.KeyCode.T then
  168. toggleGUIVisibility()
  169. end
  170. end)
  171.  
  172. warn ("Si vous rencontrez des problème avec mon script aller m'écricre en privé sur Discord: maxproglitcher ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement