This is probably a very silly question that is easy to solve, but i have looked for hours and have been unable to solve my problem. I would like to be able to take a user input (into my text box) and save the input onto a server, datastore would be the obvious one but I have tried getting this to work and it did not work. My method was to create a variable:
SERVERINFO = TextBox.Text
and use that variable to save information to the server but it has not seemed to work. Any help would be greatly appreciated!
Many thanks :)
there are several ways you can do this. you need a value in the workspace representing what you need to save. Here is the easiest: in a script
local function createEvent(eventName) local event = game.ReplicatedStorage:FindFirstChild(eventName) if not event then event = Instance.new("RemoteEvent", game.ReplicatedStorage) event.Name = eventName end return event end local save= createEvent("savedata") save.OnServerEvent:Connect(function(player, newboxdata) local hh = workspace:FindFirstChild("YourValueName") hh.Value = newboxdata
And in a local script:
function lmbo() local xb = script.Parent.Parent.TextBox game.ReplicatedStorage:FindFirstChild("savedata"):FireServer(xb.Text) end script.Parent.Activated:Connect(lmbo)
The localscript will be in the button, and the text you want saved will be in the textbox. This will update the server on the text in that player's box, but will not update any other clients. It can also be overwritten by other clients. If this isn't what you intended, tell me and i will help you more. See ya!
You could do that, or you could do this:
--Client local RS = game:GetService("ReplicatedStorage") local TextEvent = ReplicatedStorage:WaitForChild("textEvent") --when the player inputs text TextEvent:fireServer(TextBox.Text) --Server local DSS = game:GetService("DataStoreService") DataStore = DSS:getDataStore("TextInfo") local RS = game:GetService("ReplicatedStorage") local TextEvent = Instance.new("RemoteEvent", RS) TextEvent.name = "textEvent" local function onTextRecived(player, text) -- need the player because client automatically adds it in print(player.." send this text: "..text) DataStore:SetAsync(player, text) -- I know you said no Data Store, but maybe you were using it wrong? if not just substitute this for the comment end TextEvent.OnServerEvent:connect(onTextRecived)
This might solve your problem if not, use the comments