I am trying to make a script that detects a folder, then gets the child of that folder, however it is not working right.
I need it to dectect the instance because the folders name is always going to be the players user ID.
local data = game.ReplicatedStorage.PlayerData:FindFirstAncestorWhichIsA("Folder")
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if data:FindFirstChild("Stats").Time.Value == 1 then
game.ServerScriptService.DataStorer_DataStore.Plr.Secret=true
print("True")
end
end
end)
I get this error in return:
I am trying to reach the stats folder:

Any ideas on how to detect this folder and the children?