What i am trying to do: I am trying to make it where if you touch a brick, and you have over 1b rap(in game), you will get teleported to an area.
The rap is stored in a datastore, and i combined a couple scripts to try to make this work.
local LocalPlayer = game.Players.LocalPlayer
local data = {};
local dataStore = game:GetService("DataStoreService");
local sortedRAP = dataStore:GetOrderedDataStore("AveragePricee");
local playerData = data[LocalPlayer.UserId];
local assets = playerData and playerData.Assets;
local statistics = assets and playerData.Statistics;
local rap = sortedRAP:GetAsync(LocalPlayer.UserId, statistics.AveragePrice)
local rapneeded = 1,000,000,000
local metaData = {};
metaData.__index = metaData;
function metaData:getSortedDataStore()
return sortedRAP;
end
if rap >= rapneeded then
place = CFrame.new(-17.342, 47.625, -43.636)
script.Parent.Touched:connect(function(p)
local humanoid = p.Parent:findFirstChild("Humanoid")
if (humanoid ~= nil) then
humanoid.Torso.CFrame = place
end
end)
end
Any help is appreciated.

3 comments
Use codeblock please!
Wow, terrible way to use datastores and cash and stuff.
I'm not creating a datastore, but trying to get a value of a players cash from the datastore i already have.