Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script for Roblox executors and mobile
- -- Advanced In-game Player Click and Join Year Notification Script with Top Screen Notification
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- local HttpService = game:GetService("HttpService")
- local TweenService = game:GetService("TweenService")
- -- Create the notification function
- local function sendNotification(player, joinYear)
- -- Create a notification at the top of the screen
- local screenGui = Instance.new("ScreenGui", LocalPlayer.PlayerGui)
- local notification = Instance.new("TextLabel", screenGui)
- notification.Size = UDim2.new(0.3, 0, 0.1, 0)
- notification.Position = UDim2.new(0.35, 0, 0, 0) -- Top center position
- notification.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- notification.TextColor3 = Color3.fromRGB(255, 255, 255)
- notification.TextScaled = true
- notification.Text = player.DisplayName .. " joined Roblox in " .. joinYear
- notification.BackgroundTransparency = 0.3
- notification.BorderSizePixel = 0
- notification.Visible = true
- -- Tween the notification to fade out after 6 seconds
- wait(6)
- local fadeOut = TweenService:Create(notification, TweenInfo.new(1), {TextTransparency = 1, BackgroundTransparency = 1})
- fadeOut:Play()
- fadeOut.Completed:Connect(function()
- screenGui:Destroy()
- end)
- end
- -- Function to fetch the join year asynchronously
- local function fetchJoinYear(player, callback)
- local success, result = pcall(function()
- return HttpService:JSONDecode(game:HttpGet("https://users.roblox.com/v1/users/" .. player.UserId)).created
- end)
- if success and result then
- local joinYear = string.sub(result, 1, 4)
- callback(joinYear)
- else
- warn("Failed to retrieve join date for player: " .. player.DisplayName)
- callback("Unknown")
- end
- end
- -- Function to detect player click with confirmation
- local function onPlayerClick(player)
- if player ~= LocalPlayer then
- -- Create a confirmation prompt
- local confirmationGui = Instance.new("ScreenGui", LocalPlayer.PlayerGui)
- local frame = Instance.new("Frame", confirmationGui)
- frame.Size = UDim2.new(0.5, 0, 0.3, 0)
- frame.Position = UDim2.new(0.25, 0, 0.35, 0)
- frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- local text = Instance.new("TextLabel", frame)
- text.Size = UDim2.new(1, 0, 0.6, 0)
- text.Position = UDim2.new(0, 0, 0, 0)
- text.Text = "View join date for " .. player.DisplayName .. "?"
- text.TextColor3 = Color3.fromRGB(255, 255, 255)
- text.TextScaled = true
- text.BackgroundTransparency = 1
- local yesButton = Instance.new("TextButton", frame)
- yesButton.Size = UDim2.new(0.5, 0, 0.2, 0)
- yesButton.Position = UDim2.new(0, 0, 0.6, 0)
- yesButton.Text = "Yes"
- yesButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
- local noButton = Instance.new("TextButton", frame)
- noButton.Size = UDim2.new(0.5, 0, 0.2, 0)
- noButton.Position = UDim2.new(0.5, 0, 0.6, 0)
- noButton.Text = "No"
- noButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- yesButton.MouseButton1Click:Connect(function()
- confirmationGui:Destroy()
- fetchJoinYear(player, function(joinYear)
- sendNotification(player, joinYear)
- end)
- end)
- noButton.MouseButton1Click:Connect(function()
- confirmationGui:Destroy()
- end)
- end
- end
- -- Connect mouse input to detect clicks on players
- local function onMouseClick()
- local mouse = LocalPlayer:GetMouse()
- mouse.Button1Down:Connect(function()
- local target = mouse.Target
- if target and target.Parent then
- local clickedPlayer = Players:GetPlayerFromCharacter(target.Parent)
- if clickedPlayer then
- onPlayerClick(clickedPlayer)
- end
- end
- end)
- end
- -- Run the mouse click function
- onMouseClick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement