So when the game starts, it’s supposed to load in data (if any) that has been saved. It “works”, although almost each time I join, only certain data loads in — what is the issue? Also please note that this is currently the only script loading data, I have it cloning itself into the claimable parts.
if OwnerData:GetAsync("StatueOwners") == nil then
print(script.Parent.Parent.Name.." is unclaimed!")
elseif OwnerData:GetAsync("StatueOwners") > 0 then
wait()
ClickDetector:Destroy()
game.Workspace:FindFirstChild("data"):FindFirstChild(script.Parent.Parent.Name).Value = OwnerData:GetAsync("StatueOwners")
local id = game.Workspace:WaitForChild("data"):WaitForChild(script.Parent.Parent.Name).Value
local username = game:GetService("Players"):GetNameFromUserIdAsync(tonumber(id))
clone.TextLabel.Text = username
else
print(script.Parent.Parent.Name.." is unclaimed!")
end
game.ServerStorage.RemoteEvent.Event:Connect(function()
local ownerdata = game.Workspace:FindFirstChild("data"):FindFirstChild(script.Parent.Parent.Name)
ownerdata.Value = player.UserId
wait(1)
OwnerData:SetAsync("StatueOwners", ownerdata.Value)
end)