local FindGui = game:GetService("CoreGui"):FindFirstChild("PStalk")
if FindGui ~= nil then FindGui:Destroy() end 

local ScreenGui = Instance.new("ScreenGui")
local Holder = Instance.new("Frame")
local Title = Instance.new("TextLabel")
local DiscId = Instance.new("TextBox")
local Splitter = Instance.new("TextLabel")
local RblxId = Instance.new("TextBox")
local RblxUser = Instance.new("TextBox")
local Name = Instance.new("TextLabel")
local Id = Instance.new("TextLabel")
local Splitter_2 = Instance.new("TextLabel")
local Rap = Instance.new("TextLabel")
local Online = Instance.new("TextLabel")
local Joined = Instance.new("TextLabel")
local LOnline = Instance.new("TextLabel")
local ImageLabel = Instance.new("ImageLabel")
local Refresh = Instance.new("TextButton")
local jGame = Instance.new("TextButton")
local cResults = Instance.new("TextButton")
local Credits = Instance.new("TextLabel")
local Exit = Instance.new("TextButton")

ScreenGui.Parent = game:GetService("CoreGui")
ScreenGui.Name = "PStalk"
ScreenGui.ResetOnSpawn = false

Holder.Name = "Holder"
Holder.Parent = ScreenGui
Holder.BackgroundColor3 = Color3.new(0.129412, 0.129412, 0.129412)
Holder.BorderSizePixel = 0
Holder.Position = UDim2.new(0.429005295, 0, 0.168618232, 0)
Holder.Size = UDim2.new(0.16365914, 0, 0.571428657, 0)
Holder.Active = true
Holder.Draggable = true

Title.Name = "Title"
Title.Parent = Holder
Title.BackgroundColor3 = Color3.new(1, 1, 1)
Title.BackgroundTransparency = 0.89999997615814
Title.BorderSizePixel = 0
Title.Position = UDim2.new(-0.00233796239, 0, 0, 0)
Title.Size = UDim2.new(1.00233793, 0, 0.0676229522, 0)
Title.Font = Enum.Font.ArialBold
Title.Text = "Player Stalker"
Title.TextColor3 = Color3.new(1, 1, 1)
Title.TextSize = 30

DiscId.Name = "DiscId"
DiscId.Parent = Holder
DiscId.BackgroundColor3 = Color3.new(0.45098, 0.45098, 0.45098)
DiscId.BorderSizePixel = 0
DiscId.Position = UDim2.new(0.0408719331, 0, 0.137295112, 0)
DiscId.Size = UDim2.new(0.263487697, 0, 0.0528688543, 0)
DiscId.Font = Enum.Font.Code
DiscId.PlaceholderColor3 = Color3.new(1, 1, 1)
DiscId.PlaceholderText = "Discord ID"
DiscId.Text = ""
DiscId.TextColor3 = Color3.new(1, 1, 1)
DiscId.TextSize = 14
DiscId.TextScaled = true

Splitter.Name = "Splitter"
Splitter.Parent = Holder
Splitter.BackgroundColor3 = Color3.new(1, 1, 1)
Splitter.BackgroundTransparency = 0.89999997615814
Splitter.BorderSizePixel = 0
Splitter.Position = UDim2.new(0.0435967296, 0, 0.0963114724, 0)
Splitter.Size = UDim2.new(0.912806451, 0, 0.0266393777, 0)
Splitter.Font = Enum.Font.ArialBold
Splitter.Text = "Methods"
Splitter.TextColor3 = Color3.new(1, 1, 1)
Splitter.TextSize = 14

RblxId.Name = "RblxId"
RblxId.Parent = Holder
RblxId.BackgroundColor3 = Color3.new(0.45098, 0.45098, 0.45098)
RblxId.BorderSizePixel = 0
RblxId.Position = UDim2.new(0.367847383, 0, 0.137295112, 0)
RblxId.Size = UDim2.new(0.263487697, 0, 0.0528688543, 0)
RblxId.Font = Enum.Font.Code
RblxId.PlaceholderColor3 = Color3.new(1, 1, 1)
RblxId.PlaceholderText = "Roblox ID"
RblxId.Text = ""
RblxId.TextColor3 = Color3.new(1, 1, 1)
RblxId.TextSize = 14
RblxId.TextScaled = true

RblxUser.Name = "RblxUser"
RblxUser.Parent = Holder
RblxUser.BackgroundColor3 = Color3.new(0.45098, 0.45098, 0.45098)
RblxUser.BorderSizePixel = 0
RblxUser.Position = UDim2.new(0.692098022, 0, 0.137295112, 0)
RblxUser.Size = UDim2.new(0.263487697, 0, 0.0528688543, 0)
RblxUser.Font = Enum.Font.Code
RblxUser.PlaceholderColor3 = Color3.new(1, 1, 1)
RblxUser.PlaceholderText = "Roblox User"
RblxUser.Text = ""
RblxUser.TextColor3 = Color3.new(1, 1, 1)
RblxUser.TextSize = 14
RblxUser.TextScaled = true

Exit.Name = "Exit"
Exit.Parent = Holder
Exit.BackgroundColor3 = Color3.new(0.45098, 0.45098, 0.45098)
Exit.BackgroundTransparency = 1
Exit.BorderSizePixel = 0
Exit.Position = UDim2.new(0.897713304, 0, 0.00204921141, 0)
Exit.Size = UDim2.new(0, 32, 0, 30)
Exit.Font = Enum.Font.ArialBold
Exit.Text = "X"
Exit.TextColor3 = Color3.new(1, 1, 1)
Exit.TextSize = 20

Name.Name = "Name"
Name.Parent = Holder
Name.BackgroundColor3 = Color3.new(1, 1, 1)
Name.BackgroundTransparency = 1
Name.BorderSizePixel = 0
Name.Position = UDim2.new(0.0435967296, 0, 0.290983617, 0)
Name.Size = UDim2.new(0.912806451, 0, 0.0512295179, 0)
Name.Font = Enum.Font.ArialBold
Name.Text = "User: ROBLOX"
Name.TextColor3 = Color3.new(1, 1, 1)
Name.TextSize = 14
Name.TextXAlignment = Enum.TextXAlignment.Left

Id.Name = "Id"
Id.Parent = Holder
Id.BackgroundColor3 = Color3.new(1, 1, 1)
Id.BackgroundTransparency = 1
Id.BorderSizePixel = 0
Id.Position = UDim2.new(0.0435967296, 0, 0.342213124, 0)
Id.Size = UDim2.new(0.912806451, 0, 0.0512295179, 0)
Id.Font = Enum.Font.ArialBold
Id.Text = "UserId: 1"
Id.TextColor3 = Color3.new(1, 1, 1)
Id.TextSize = 14
Id.TextXAlignment = Enum.TextXAlignment.Left

Splitter_2.Name = "Splitter"
Splitter_2.Parent = Holder
Splitter_2.BackgroundColor3 = Color3.new(1, 1, 1)
Splitter_2.BackgroundTransparency = 0.89999997615814
Splitter_2.BorderSizePixel = 0
Splitter_2.Position = UDim2.new(0.0435967296, 0, 0.264344245, 0)
Splitter_2.Size = UDim2.new(0.912806451, 0, 0.0266393777, 0)
Splitter_2.Font = Enum.Font.ArialBold
Splitter_2.Text = "Statistics"
Splitter_2.TextColor3 = Color3.new(1, 1, 1)
Splitter_2.TextSize = 14

Rap.Name = "Rap"
Rap.Parent = Holder
Rap.BackgroundColor3 = Color3.new(1, 1, 1)
Rap.BackgroundTransparency = 1
Rap.BorderSizePixel = 0
Rap.Position = UDim2.new(0.0435967296, 0, 0.393442631, 0)
Rap.Size = UDim2.new(0.912806451, 0, 0.0512295179, 0)
Rap.Font = Enum.Font.ArialBold
Rap.Text = "RAP: 0"
Rap.TextColor3 = Color3.new(1, 1, 1)
Rap.TextSize = 14
Rap.TextXAlignment = Enum.TextXAlignment.Left

Online.Name = "Online"
Online.Parent = Holder
Online.BackgroundColor3 = Color3.new(1, 1, 1)
Online.BackgroundTransparency = 1
Online.BorderSizePixel = 0
Online.Position = UDim2.new(0.0435967296, 0, 0.444672137, 0)
Online.Size = UDim2.new(0.912806451, 0, 0.0512295179, 0)
Online.Font = Enum.Font.ArialBold
Online.Text = "Online: false"
Online.TextColor3 = Color3.new(1, 1, 1)
Online.TextSize = 14
Online.TextXAlignment = Enum.TextXAlignment.Left

Joined.Name = "Joined"
Joined.Parent = Holder
Joined.BackgroundColor3 = Color3.new(1, 1, 1)
Joined.BackgroundTransparency = 1
Joined.BorderSizePixel = 0
Joined.Position = UDim2.new(0.0408719331, 0, 0.495901644, 0)
Joined.Size = UDim2.new(0.912806451, 0, 0.0512295179, 0)
Joined.Font = Enum.Font.ArialBold
Joined.Text = "Joined: 1/1/1970 00:00:00"
Joined.TextColor3 = Color3.new(1, 1, 1)
Joined.TextSize = 14
Joined.TextXAlignment = Enum.TextXAlignment.Left

LOnline.Name = "LOnline"
LOnline.Parent = Holder
LOnline.BackgroundColor3 = Color3.new(1, 1, 1)
LOnline.BackgroundTransparency = 1
LOnline.BorderSizePixel = 0
LOnline.Position = UDim2.new(0.0435967296, 0, 0.547131121, 0)
LOnline.Size = UDim2.new(0.912806451, 0, 0.0512295179, 0)
LOnline.Font = Enum.Font.ArialBold
LOnline.Text = "LOnline: 1/1/1970 00:00:00"
LOnline.TextColor3 = Color3.new(1, 1, 1)
LOnline.TextSize = 14
LOnline.TextXAlignment = Enum.TextXAlignment.Left

ImageLabel.Parent = Holder
ImageLabel.BackgroundColor3 = Color3.new(1, 1, 1)
ImageLabel.BackgroundTransparency = 1
ImageLabel.BorderSizePixel = 0
ImageLabel.Position = UDim2.new(0.636754453, 0, 0.290983617, 0)
ImageLabel.Size = UDim2.new(0, 100, 0, 100)
ImageLabel.Image = "rbxasset://textures/ui/GuiImagePlaceholder.png"

Refresh.Name = "Refresh"
Refresh.Parent = Holder
Refresh.BackgroundColor3 = Color3.new(0.45098, 0.45098, 0.45098)
Refresh.BorderSizePixel = 0
Refresh.Position = UDim2.new(0.636754453, 0, 0.479508162, 0)
Refresh.Size = UDim2.new(0, 100, 0, 16)
Refresh.Font = Enum.Font.Code
Refresh.Text = "Refresh"
Refresh.TextColor3 = Color3.new(1, 1, 1)
Refresh.TextSize = 14

jGame.Name = "jGame"
jGame.Parent = Holder
jGame.BackgroundColor3 = Color3.new(0.45098, 0.45098, 0.45098)
jGame.BorderSizePixel = 0
jGame.Position = UDim2.new(0.636754453, 0, 0.520491779, 0)
jGame.Size = UDim2.new(0, 100, 0, 17)
jGame.Font = Enum.Font.Code
jGame.Text = "Join Game"
jGame.TextColor3 = Color3.new(1, 1, 1)
jGame.TextSize = 14

cResults.Name = "cResults"
cResults.Parent = Holder
cResults.BackgroundColor3 = Color3.new(0.45098, 0.45098, 0.45098)
cResults.BorderSizePixel = 0
cResults.Position = UDim2.new(0.636754453, 0, 0.563524544, 0)
cResults.Size = UDim2.new(0, 100, 0, 17)
cResults.Font = Enum.Font.Code
cResults.Text = "Copy Results"
cResults.TextColor3 = Color3.new(1, 1, 1)
cResults.TextSize = 14

Credits.Name = "Credits"
Credits.Parent = Holder
Credits.BackgroundColor3 = Color3.new(1, 1, 1)
Credits.BackgroundTransparency = 1
Credits.BorderSizePixel = 0
Credits.Position = UDim2.new(0.0435967296, 0, 0.934426188, 0)
Credits.Size = UDim2.new(0.912806451, 0, 0.0512295179, 0)
Credits.Font = Enum.Font.ArialBold
Credits.Text = "Made by: pigeon#1818"
Credits.TextColor3 = Color3.new(1, 1, 1)
Credits.TextSize = 16

local CurrentId = 1
local CurrentGame = 1
local CurrentPlace = 1
local function RefreshChoices(UserId)
    Rap.Text = "RAP: 0"
    OnlineNot = "false"
    local URL = ("http://api.roblox.com/users/"..UserId)
    pcall(function() Http = game:GetService("HttpService"):JSONDecode(game:HttpGet(URL)) end)
	pcall(function() Http2 = game:GetService("HttpService"):JSONDecode(game:HttpGet("http://api.roblox.com/users/"..UserId.."/onlinestatus")) end)
    Name.Text = "User: "..Http.Username
    Id.Text = "UserId: "..UserId
    CurrentId = UserId
    CurrentGame = Http2.GameId
    CurrentPlace = Http2.PlaceId
    if Http2.IsOnline == false then OnlineNot = "false" else OnlineNot = "true" end
    Online.Text = "Online: "..OnlineNot
    local URL = ("https://inventory.roblox.com/v1/users/"..UserId.."/assets/collectibles?sortOrder=Asc&limit=100")
    pcall(function() 
        Http = game:GetService("HttpService"):JSONDecode(game:HttpGet(URL))
        local RAP = 0
        function ListItems(Look)
        	for i,v in pairs(Look.data) do
        	    if v.recentAveragePrice ~= nil then
        		    RAP = RAP+v.recentAveragePrice
        		end
    		end
    	end
        ListItems(Http)
    	Pages = 1
    	for i = 1,500 do
        	if Http.nextPageCursor ~= null then
        		pcall(function() Http = game:GetService("HttpService"):JSONDecode(game:HttpGet(URL.."&cursor="..Http.nextPageCursor)) end)
        		ListItems(Http)
        		Pages = Pages+1
        	else
        	    Rap.Text = "RAP: "..RAP
        	    break
    		end
    	end
    end)
    ImageLabel.Image = game:GetService("Players"):GetUserThumbnailAsync(UserId, Enum.ThumbnailType.AvatarThumbnail, Enum.ThumbnailSize.Size420x420)
    pcall(function() Http = game:GetService("HttpService"):JSONDecode(game:HttpGet("https://users.roblox.com/v1/users/"..UserId)) end)
	local Created = Http.created:split("T")
	local Created2 = Created[2]:split(".")
    Joined.Text = "Joined: "..Created[1].." "..Created[2]:sub(1,8)
	local Created = Http2.LastOnline:split("T")
    local Created2 = Created[2]:split(".")
    LOnline.Text = "LOnline: "..Created[1].." "..Created[2]:sub(1,8)
end

RefreshChoices(1334093798)

DiscId.FocusLost:Connect(function()
    local URL = ("https://verify.eryn.io/api/user/"..DiscId.Text)
	local Http = game:GetService("HttpService"):JSONDecode(game:HttpGet(URL))
	RefreshChoices(Http.robloxId)
end)

RblxId.FocusLost:Connect(function()
    RefreshChoices(RblxId.Text)
end)

RblxUser.FocusLost:Connect(function()
    local URL = ("https://api.roblox.com/users/get-by-username?username="..RblxUser.Text)
	local Http = game:GetService("HttpService"):JSONDecode(game:HttpGet(URL))
	RefreshChoices(Http.Id)
end)

local xResults = ""
cResults.MouseButton1Down:Connect(function()
    xResults = Name.Text.."\n"..Id.Text.."\n"..Online.Text.."\n"..Joined.Text.."\n"..LOnline.Text.."\n"..Rap.Text
    setclipboard(xResults)
    cResults.Text = "Copied Results!"
    wait(1)
    cResults.Text = "Copy Results"
end)

Refresh.MouseButton1Down:Connect(function()
    RefreshChoices(CurrentId)
    Refresh.Text = "Refreshed!"
    wait(1)
    Refresh.Text = "Refresh"
end)

jGame.MouseButton1Down:Connect(function()
    pcall(function()
        game:GetService("TeleportService"):TeleportToPlaceInstance(CurrentPlace, CurrentGame, game:GetService("Players").LocalPlayer) 
    end)
    jGame.Text = "Joining game..."
    wait(10)
    jGame.Text = "Failed!"
    wait(1)
    jGame.Text = "Join Game"
end)

Exit.MouseButton1Down:Connect(function()
    Holder:Destroy()
end)
