Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with DataStore UpdateAsync please?

Asked by 4 years ago

My issue is that I'm trying to change one argument from a DataStore and its returning the error "Unable to cast value to function". The function names mean nothing, I copied them from a sample script but I'm not sure why its not working. I am trying to change one argument which is the "Unread" to "Read", which is then followed by table values, but its not working. This is what it looks like in the DataStore editor: https://cdn.discordapp.com/attachments/413088916678377493/606853036232409098/unknown.png

local DataStoreService = game:GetService("DataStoreService") local applicationStore = DataStoreService:GetDataStore("Applications")

local function makeNameUpper(currentName,Status) local newName = Status table.remove(currentName,1) local Table = {} for i=1,table.getn(currentName) do table.insert(Table,table.getn(Table)+1,currentName[i]) end table.insert(Table,1,Status) for i=1,#Table do print(Table[i]) end return Table end

local success, newName = pcall(function() return applicationStore:UpdateAsync("Application_17795652",(makeNameUpper((applicationStore:GetAsync("Application_17795652")),"Read"))) end)

if success then print("Uppercase Name:", newName) else print(newName) end

0
Please format your code correctly. SmartNode 383 — 4y
0
the link doesnt go anywhere btw sturdy2004 110 — 4y

Answer this question