Hello, I was trying to make a system to store players datas inside a database that I own instead of datastores because datastores have a limit. I figured out how to make the script to send datas, but not how to get the datas saved. I tryed things but somehow I can't figure it out. Can semeone help me? Thanks
Current script:
local HttpsService = game:GetService('HttpService')
local domain = won't share it :p
game.ReplicatedStorage.Remote.SendData.OnServerEvent:Connect(function(plr,sent)
local sucess = pcall(function()
HttpsService:PostAsync(domain,"name="..plr.Name.."&age="..sent,2)
end)
if not sucess then
print("Error When Communating To: DATABASE")
else
print("Sent Datas")
end
end)
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new('Folder')
Leaderstats.Name = "Leaderstats"
local value = Instance.new('StringValue')
value.Name = "Age"
value.Value = HttpsService:GetAsync(domain,true)
end)
script in my server: (index.php)
<html>
<head>
<title>Data from Roblox</title>
<h3>Data from Roblox</h3>
</head>
<body>
<?php
$name = $_POST["name"];
$age = $_POST["age"];
$con = new mysqli("localhost","nani","nani","nani");
if(mysqli_connect_errno()){
echo(mysqli_connect_error());
}
if($name!=NULL and $age != NULL){
$con->query("INSERT INTO main (name,age) VALUES ('$name','$age')");
}
$result = $con->query("SELECT * FROM main");
if($result->num_rows > 0){
echo("Rows: <br>");
while($row = $result->fetch_assoc()){
echo($row["name"] . ": " . $row["age"] . "<br>");
}
}
else{
echo("Database is empty");
}
?>
</body>
</html>
Should I change something to make it receive datas?
