Created
June 1, 2025 18:34
-
-
Save MajorTal/800dc1ac542430a79fd9e206a365495c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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