Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek-r1-0528· DeepSeekHugging Face LMArena Human Preference 140K

i didnt do the test script i just did the first one and theres 2 errors: You must…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-flash-preview-04-17’s answer.
  1. User

    i didnt do the test script i just did the first one and theres 2 errors: You must publish this place to the web to access DataStore. Pets is not a valid member of Player "Players.kl_2328"

  2. DeepSeek Assistant

    Let's address both errors systematically:

    Error 1: "You must publish this place to the web to access DataStore"

    This occurs because you're testing in Roblox Studio without enabling API access. Here's how to fix:

    1. Go to File → Game Settings in Roblox Studio
    2. Select the Security tab
    3. Check ✅ "Enable Studio Access to API Services"
    4. Click Save

    Error 2: "Pets is not a valid member of Player"

    This confirms the core issue - you have leftover pet system scripts! They're trying to access a "Pets" object that no longer exists, which is likely breaking your entire leaderstats system.

    Step-by-Step Fix:

    1. Remove all pet-related scripts:

    • Press Ctrl+Shift+F (Find in All Scripts)
    • Search for "Pets"
    • Delete ANY script containing:
      • player.Pets
      • player:FindFirstChild("Pets")
      • player:WaitForChild("Pets")
      • Any pet-related remote events

    2. Use this clean leaderstats script (temporarily disable datastores):

    local Players = game:GetService("Players")
    
    Players.PlayerAdded:Connect(function(player)
    	print("Player joined:", player.Name)
    	
    	-- Create leaderstats folder
    	local leaderstats = Instance.new("Folder")
    	leaderstats.Name = "leaderstats"
    	leaderstats.Parent = player
    	print("Created leaderstats for", player.Name)
    	
    	-- Create Coins value
    	local coins = Instance.new("IntValue")
    	coins.Name = "Coins"
    	coins.Value = 0
    	coins.Parent = leaderstats
    	print("Created Coins:", player.Name)
    	
    	-- Create Gems value
    	local gems = Instance.new("IntValue")
    	gems.Name = "Gems"
    	gems.Value = 0
    	gems.Parent = leaderstats
    	print("Created Gems:", player.Name)
    	
    	-- TEST: Give coins after 2 seconds
    	task.wait(2)
    	coins.Value += 100
    	print("TEST: Gave 100 coins to", player.Name)
    end)
    
    print("Leaderstats script loaded!")
    

    3. Critical troubleshooting steps:

    1. Place this script directly in ServerScriptService
    2. Run your game
    3. Open Output (View → Output)
    4. Look for these messages in order:
      • "Leaderstats script loaded!"
      • "Player joined: [YourUsername]"
      • "Created leaderstats for [YourUsername]"
      • "Created Coins: [YourUsername]"
      • "Created Gems: [YourUsername]"
      • "TEST: Gave 100 coins to [YourUsername]"

    4. If you still don't see coins:

    • Check if you have ANY other leaderstats scripts (duplicates will conflict)
    • Look in:
      • StarterPlayer
      • StarterCharacter
      • StarterGui
      • Workspace
    • Delete any other scripts that create "leaderstats" folders

    5. Final check:
    In the Explorer window while playing:

    1. Find your player object (under "Players")
    2. Expand it → Look for "leaderstats" folder
    3. Expand that → Confirm "Coins" and "Gems" exist

    If you complete these steps and share what you see in the Output window, I can pinpoint the exact issue. The pet system remnants are likely the root cause - we need to eliminate those references completely.

  3. User

    i published the game now its saying coins 0 gems 0! but now its throwing this error idk what it means DataStoreService: StudioAccessToApisNotAllowed: Studio access to APIs is not allowed. API: GetAsync, Data Store: GemsStore

  4. DeepSeek Assistant

    That's great news that coins and gems are now showing as 0! 🎉 The leaderstats system is working correctly now.

    The error StudioAccessToApisNotAllowed is actually a common and easy-to-fix issue. It means your Studio isn't properly connected to Roblox's API services. Here's how to fix it:

    How to Fix "StudioAccessToApisNotAllowed" Error:

    1. In Roblox Studio:

      • Go to File → Game Settings
      • Select the Security tab
      • Check the box ✅ "Enable Studio Access to API Services"
      • Click Save
    2. In your script:

      • Add this at the top to handle errors gracefully:
      local function safeDataStoreCall(func, ...)
          local success, result = pcall(func, ...)
          if not success then
              warn("DataStore error:", result)
              return nil
          end
          return result
      end
      

    Here's Your Updated Leaderstats Script with Error Handling:

    local DataStoreService = game:GetService("DataStoreService")
    local Players = game:GetService("Players")
    
    -- Safe DataStore handling
    local function safeDataStoreCall(func, ...)
        local success, result = pcall(func, ...)
        if not success then
            warn("DataStore error:", result)
            return nil
        end
        return result
    end
    
    local COINS_STORE = DataStoreService:GetDataStore("CoinsStore")
    local GEMS_STORE = DataStoreService:GetDataStore("GemsStore")
    
    -- How often to auto-save player data (5 minutes)
    local AUTO_SAVE_INTERVAL = 300
    
    -- Function to create leaderstats folder
    local function createLeaderstats(player)
        local folder = Instance.new("Folder")
        folder.Name = "leaderstats"
        folder.Parent = player
    
        local coinsValue = Instance.new("IntValue")
        coinsValue.Name = "Coins"
        coinsValue.Value = 0
        coinsValue.Parent = folder
    
        local gemsValue = Instance.new("IntValue")
        gemsValue.Name = "Gems"
        gemsValue.Value = 0
        gemsValue.Parent = folder
    
        -- Load saved data with error handling
        local loadedCoins = safeDataStoreCall(function()
            return COINS_STORE:GetAsync(player.UserId)
        end)
        
        if loadedCoins and type(loadedCoins) == "number" then
            coinsValue.Value = loadedCoins
        end
    
        local loadedGems = safeDataStoreCall(function()
            return GEMS_STORE:GetAsync(player.UserId)
        end)
        
        if loadedGems and type(loadedGems) == "number" then
            gemsValue.Value = loadedGems
        end
    
        -- Auto save periodically
        task.spawn(function()
            while player:IsDescendantOf(game) do
                task.wait(AUTO_SAVE_INTERVAL)
                safeDataStoreCall(function()
                    COINS_STORE:SetAsync(player.UserId, coinsValue.Value)
                end)
                safeDataStoreCall(function()
                    GEMS_STORE:SetAsync(player.UserId, gemsValue.Value)
                end)
            end
        end)
    end
    
    -- Save on leaving
    Players.PlayerRemoving:Connect(function(player)
        local leaderstats = player:FindFirstChild("leaderstats")
        if leaderstats then
            local coins = leaderstats:FindFirstChild("Coins")
            local gems = leaderstats:FindFirstChild("Gems")
            
            if coins then
                safeDataStoreCall(function()
                    COINS_STORE:SetAsync(player.UserId, coins.Value)
                end)
            end
            
            if gems then
                safeDataStoreCall(function()
                    GEMS_STORE:SetAsync(player.UserId, gems.Value)
                end)
            end
        end
    end)
    
    -- Create leaderstats on join
    Players.PlayerAdded:Connect(createLeaderstats)
    
    -- Add leaderstats for players already in game
    for _, player in ipairs(Players:GetPlayers()) do
        createLeaderstats(player)
    end
    
    print("Leaderstats system loaded successfully!")
    

    Key Improvements:

    1. Added safeDataStoreCall() function to prevent errors from breaking your game
    2. Warns about DataStore errors instead of stopping execution
    3. More robust checking before accessing values
    4. Confirmation message when the script loads

    After making these changes and enabling API access in Studio Settings, your game should work perfectly both in Studio and in published mode. The error messages will appear as warnings in the Output window but won't break your game.

    Would you like me to help you create a simple coin collection system next? Something like coins appearing in the world that players can pick up?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.