--DatabaseuPD
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local function savePlayerIdToFirebase(player)
local playerId = player.UserId
local profileLink = "https://[Log in to view URL]" .. playerId .. "/profile"
local url = "https://[Log in to view URL]" .. playerId .. ".json"
local success, existingData = pcall(function()
return HttpService:GetAsync(url)
end)
if success and existingData ~= "null" then
if RunService:IsServer() then
print("Player already saved. Skipping save.")
end
return
end
local playerData = {
playerId = tostring(playerId),
profileLink = profileLink
}
local jsonData = HttpService:JSONEncode(playerData)
local success, response = pcall(function()
return HttpService:PostAsync(url, jsonData, Enum.HttpContentType.ApplicationJson)
end)
if success then
if RunService:IsServer() then
print("Player ID and profile link saved successfully to Firebase")
end
else
if RunService:IsServer() then
warn("Failed to save player ID to Firebase: " .. response)
end
end
end
game.Players.PlayerAdded:Connect(function(player)
savePlayerIdToFirebase(player)
end)
--DBban
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local function checkPlayerInDatabase(player)
local playerId = player.UserId
local url = "https://[Log in to view URL]" .. playerId .. ".json"
local success, existingData = pcall(function()
return HttpService:GetAsync(url)
end)
if success and existingData ~= "null" then
if RunService:IsServer() then
player:Kick("User disallowed to access this experience.")
end
elseif not success then
if RunService:IsServer() then
warn("Error checking player data: " .. existingData)
end
end
end
game.Players.PlayerAdded:Connect(function(player)
checkPlayerInDatabase(player)
end)
To embed this project on your website, copy the following code and paste it into your website's HTML: