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

Why is this not saving the text in a datastore?

Asked by 5 years ago

I have a server script:

local ds = game:GetService("DataStoreService")
local record = ds:GetDataStore("Records")
game.ReplicatedStorage.save.OnServerEvent:Connect(function(sender, target, message)
    print("fired, "..sender.name.." to "..target.name.." message is "..message)
    local frame = game.StarterGui.Record.Frame
    local success, errormessage = pcall(function()
    record:SetAsync(target.userId, message)
    end)
    if success then
            frame.save.Text = "Succsesfully sent!"
    else
        print("that aint it chief")
        warn("here is the error "..errormessage)
    end
end)

1 answer

Log in to vote
0
Answered by 5 years ago

Lua is Case Sensitive, so you need to have the proper naming of your properties.

Change Line 7 to

record:SetAsync(target.UserId, message)

and change Line 5 to

local frame = target.PlayerGui.Record.Frame
Ad

Answer this question