Advertisement
Mochigoz

StarterGui.AdminMenu.Main.AddMoney.ValidateButton.LocalScript

Mar 1st, 2023 (edited)
828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.93 KB | Source Code | 0 0
  1. -- Définition du dossier contenant toutes les informations des joueurs connecté sur le serveur actuel
  2.  
  3. local Players = game.Players
  4.  
  5. -- Définition du client du joueur qui exécute le script
  6.  
  7. local Player = Players.LocalPlayer
  8. --
  9.  
  10. -- Définition du PlayerGui du joueur
  11.  
  12. local PlayerGui = Player:WaitForChild("PlayerGui")
  13. --
  14.  
  15. -- Définiton du bouton de validation
  16.  
  17. local ValidateButton = script.Parent
  18. --
  19.  
  20. -- Définition de la "TextBox" contenant le nombre de "$" à donner au joueur cible
  21.  
  22. local MoneyTextBox = PlayerGui:WaitForChild("AdminMenu"):WaitForChild("Main"):WaitForChild("AddMoney"):WaitForChild("AddMoneyTextBox")
  23. --
  24.  
  25. -- Définition de la "TextBox" contenant l'ID du joueur cible pour pouvoir déterminer le joueur cible
  26.  
  27. local IdTargetTextBox = PlayerGui:WaitForChild("AdminMenu"):WaitForChild("Main"):WaitForChild("AddMoney"):WaitForChild("TargetPlayer"):WaitForChild("PlayerId")
  28. --
  29.  
  30. ValidateButton.MouseButton1Click:Connect(function()
  31.     -- Définition des valeurs de la taille de l'écran par défaut
  32.    
  33.     local XDefaultScreenSize = 1918
  34.     local YDefaultScreenSize = 1008
  35.     --
  36.    
  37.     -- Module permettant d'obtenir la taille de l'écran du joueur
  38.  
  39.     local XScreenSize = game.Players.LocalPlayer:GetMouse().ViewSizeX
  40.     local YScreenSize = game.Players.LocalPlayer:GetMouse().ViewSizeY
  41.     --
  42.    
  43.     local function SendMoneyAdmin()
  44.         -- On vérifie que l'éxécuteur soit bien Mochigoz
  45.         if Players:GetPlayerByUserId(607212075) then
  46.             local function GetNotifToTargetPlayer()
  47.                 if PlayerGui:FindFirstChild("NotifGui") then
  48.                     local NotifGui = PlayerGui:FindFirstChild("NotifGui")
  49.                     NotifGui:Destroy()
  50.                 end
  51.                 -- Création du Gui qui va accueillir le texte de la notification
  52.  
  53.                 local NotifGui = Instance.new("ScreenGui")
  54.                 NotifGui.Name = "NotifGui"
  55.                 NotifGui.Parent = PlayerGui
  56.                 --
  57.  
  58.                 -- Création du "TextLabel" qui va transmettre la notification au joueur
  59.  
  60.                 local NotifTextLabel = Instance.new("TextLabel")
  61.                 NotifTextLabel.Name = "NotifTextLabel"
  62.                 NotifTextLabel.Parent = NotifGui
  63.  
  64.                 -- Propriétés du "TextLabel"
  65.                 NotifTextLabel.TextColor3 = Color3.new(170/255, 0/255, 0/255)
  66.                 NotifTextLabel.BackgroundTransparency = 1
  67.                 NotifTextLabel.Size = UDim2.fromOffset(XScreenSize/(XDefaultScreenSize/800), YScreenSize/(YDefaultScreenSize/200))
  68.                 NotifTextLabel.Position = UDim2.fromScale(XScreenSize/(XDefaultScreenSize/0.3), YScreenSize/(YDefaultScreenSize/0.025))
  69.                 NotifTextLabel.Font = 36
  70.                 NotifTextLabel.TextScaled = true
  71.                 NotifTextLabel.RichText = true
  72.  
  73.                 -- On dit à l'éxécuteur que l'argent a bien été donné
  74.                 NotifTextLabel.Text = "L'argent a été donné !"
  75.  
  76.                 -- On attend deux secondes pour ensuite...
  77.                 wait(2)
  78.  
  79.                 -- Supprimer la notification
  80.                 NotifGui:Destroy()
  81.             end
  82.            
  83.             GetNotifToTargetPlayer()
  84.            
  85.         else
  86.             Player:Kick("Vous avez été exclus par l'Anti-Cheat pour tentative de triche")
  87.         end
  88.     end
  89.    
  90.     SendMoneyAdmin()
  91.    
  92. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement