Local script in server script can't think of other solutions

  1. What do you want to achieve?
    Suggest new features to vote in the game

  2. What is the issue?
    in 10 lines player.PlayerGui.vote.gui.crea.title.Input.Text it is a textbox Always save original text
    image

  3. What solutions have you tried so far?
    use plr or Players.LocalPlayer.PlayerGui.vote.gui.crea.title.Input.Text

ServerScriptService’s server scirpt

local replicatedstorage = game:GetService("ReplicatedStorage")
local votecreate = replicatedstorage:FindFirstChild("Vote")
local Datastoreservervice = game:GetService("DataStoreService")
local Vote = Datastoreservervice:GetDataStore("Vote")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

votecreate.OnServerEvent:Connect(function(player)
	local success, errormessage = pcall(function()
		Vote:SetAsync(player.Name, player.PlayerGui.vote.gui.crea.title.Input.Text) 
	end)
	if success then
		print("saved")
	end
	if not success then
		warn(errorMessage)
	end
end)
1 Like

You would have to get the Text of the Input on the client and send it to the server via the remote.

Like this:

Client:
local Input = path_to_text_box

votecreate:FireServer(Input.Text)
Server:
votecreate.OnServerEvent:Connect(function(player, input)
	local success, errormessage = pcall(function()
		Vote:SetAsync(player.Name, input) 
	end)
	if success then
		print("saved")
	end
	if not success then
		warn(errorMessage)
	end
end)
2 Likes