How to make the textbox save the text only for a user

Hello, im trying to make the textbox save the text when a specific player leaves. Can you help me? Thank you

3 Likes

Use a remote event to pass the text of the text box to the server then set up a datastore to store it assuming you already know how to use datastores.(If not I’m here to help :cowboy_hat_face:)

Im going to use datastores for the first time :smile: Can you help me

Sure I’ll write some code to help you out :smiley:
Edit: can I help you tomorrow morning it’s hard to type this code on my phone ;-;.

1 Like

Oh okay, Im searching for resources

Here , I’ll try to do this. Just gimme a sec.
local script:(Inside of Text box)
put a folder in replicated storage and name it events now insert a remote event into the folder and name it SAVE
Local script(Inside text box):

game.ReplicatedStorage.Events.SAVE.OnClientEvent:Connect(function(player, NewText)
script.Parent.Text = NewText
end)

script.Parent.Changed:Connect(function()
local text = script.Parent.Text
game.ReplicatedStorage.Events.SAVE:FireServer(player, text)

ServerScriptService:

local DSS = game:GetService("DataStoreService")
local TextDataStore = DSS:GetDataStore("TextStore")
game.ReplicatedStorage.Events.SAVE.OnServerEvent:Connect(function(player, text)
TextDataStore:SetAsync(player, text)
end)

game.Players.PlayerAdded:Connect(function()
local NewText = TextDataStore:GetASync(player, text)
game.ReplicatedStorage.Events.SAVE:FireClient(player, NewText)
end)

I’m a little stumped on how to send information bak. To the client though.
Edit: Still working on it.

1 Like

Dont rush yourself I have enough time :smiley: :+1:

1 Like

I think I got it go ahead and try it!

1 Like