Skip to content

Instantly share code, notes, and snippets.

@MajorTal
Created June 1, 2025 18:34
Show Gist options
  • Save MajorTal/800dc1ac542430a79fd9e206a365495c to your computer and use it in GitHub Desktop.
Save MajorTal/800dc1ac542430a79fd9e206a365495c to your computer and use it in GitHub Desktop.
local function savePoles(player)
local roomName = player:GetAttribute("Room")
local room = workspace.PlayerRooms:FindFirstChild(roomName)
if not room then return end
local polesData = {
poles = {},
roomCenter = {
x = room.Position.X,
y = room.Position.Y,
z = room.Position.Z
}
}
for _, pole in ipairs(room:GetChildren()) do
if pole:IsA("BasePart") then
table.insert(polesData.poles, {
x = pole.Position.X,
y = pole.Position.Y,
z = pole.Position.Z
})
end
end
local success, err = pcall(function()
poleDataStore:SetAsync(player.UserId, polesData)
end)
if not success then
warn("Failed to save poles for player:", player.Name, err)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment