Advertisement
qiell

Untitled

Sep 6th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. -- Script for Roblox executors and mobile
  2. -- Advanced In-game Player Click and Join Year Notification Script with Top Screen Notification
  3.  
  4. local Players = game:GetService("Players")
  5. local LocalPlayer = Players.LocalPlayer
  6. local HttpService = game:GetService("HttpService")
  7. local TweenService = game:GetService("TweenService")
  8.  
  9. -- Create the notification function
  10. local function sendNotification(player, joinYear)
  11. -- Create a notification at the top of the screen
  12. local screenGui = Instance.new("ScreenGui", LocalPlayer.PlayerGui)
  13. local notification = Instance.new("TextLabel", screenGui)
  14. notification.Size = UDim2.new(0.3, 0, 0.1, 0)
  15. notification.Position = UDim2.new(0.35, 0, 0, 0) -- Top center position
  16. notification.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  17. notification.TextColor3 = Color3.fromRGB(255, 255, 255)
  18. notification.TextScaled = true
  19. notification.Text = player.DisplayName .. " joined Roblox in " .. joinYear
  20. notification.BackgroundTransparency = 0.3
  21. notification.BorderSizePixel = 0
  22. notification.Visible = true
  23.  
  24. -- Tween the notification to fade out after 6 seconds
  25. wait(6)
  26. local fadeOut = TweenService:Create(notification, TweenInfo.new(1), {TextTransparency = 1, BackgroundTransparency = 1})
  27. fadeOut:Play()
  28.  
  29. fadeOut.Completed:Connect(function()
  30. screenGui:Destroy()
  31. end)
  32. end
  33.  
  34. -- Function to fetch the join year asynchronously
  35. local function fetchJoinYear(player, callback)
  36. local success, result = pcall(function()
  37. return HttpService:JSONDecode(game:HttpGet("https://users.roblox.com/v1/users/" .. player.UserId)).created
  38. end)
  39.  
  40. if success and result then
  41. local joinYear = string.sub(result, 1, 4)
  42. callback(joinYear)
  43. else
  44. warn("Failed to retrieve join date for player: " .. player.DisplayName)
  45. callback("Unknown")
  46. end
  47. end
  48.  
  49. -- Function to detect player click with confirmation
  50. local function onPlayerClick(player)
  51. if player ~= LocalPlayer then
  52. -- Create a confirmation prompt
  53. local confirmationGui = Instance.new("ScreenGui", LocalPlayer.PlayerGui)
  54. local frame = Instance.new("Frame", confirmationGui)
  55. frame.Size = UDim2.new(0.5, 0, 0.3, 0)
  56. frame.Position = UDim2.new(0.25, 0, 0.35, 0)
  57. frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  58.  
  59. local text = Instance.new("TextLabel", frame)
  60. text.Size = UDim2.new(1, 0, 0.6, 0)
  61. text.Position = UDim2.new(0, 0, 0, 0)
  62. text.Text = "View join date for " .. player.DisplayName .. "?"
  63. text.TextColor3 = Color3.fromRGB(255, 255, 255)
  64. text.TextScaled = true
  65. text.BackgroundTransparency = 1
  66.  
  67. local yesButton = Instance.new("TextButton", frame)
  68. yesButton.Size = UDim2.new(0.5, 0, 0.2, 0)
  69. yesButton.Position = UDim2.new(0, 0, 0.6, 0)
  70. yesButton.Text = "Yes"
  71. yesButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  72.  
  73. local noButton = Instance.new("TextButton", frame)
  74. noButton.Size = UDim2.new(0.5, 0, 0.2, 0)
  75. noButton.Position = UDim2.new(0.5, 0, 0.6, 0)
  76. noButton.Text = "No"
  77. noButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  78.  
  79. yesButton.MouseButton1Click:Connect(function()
  80. confirmationGui:Destroy()
  81. fetchJoinYear(player, function(joinYear)
  82. sendNotification(player, joinYear)
  83. end)
  84. end)
  85.  
  86. noButton.MouseButton1Click:Connect(function()
  87. confirmationGui:Destroy()
  88. end)
  89. end
  90. end
  91.  
  92. -- Connect mouse input to detect clicks on players
  93. local function onMouseClick()
  94. local mouse = LocalPlayer:GetMouse()
  95.  
  96. mouse.Button1Down:Connect(function()
  97. local target = mouse.Target
  98. if target and target.Parent then
  99. local clickedPlayer = Players:GetPlayerFromCharacter(target.Parent)
  100. if clickedPlayer then
  101. onPlayerClick(clickedPlayer)
  102. end
  103. end
  104. end)
  105. end
  106.  
  107. -- Run the mouse click function
  108. onMouseClick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement