I am creating a player look-up system using a GUI, and I need Client to Server communication in order to use the DataStore system. But the server doesn't respond.
ServerScript
local DataStoreService = game:GetService("DataStoreService") local Check = DataStoreService:GetDataStore("PayCheck") game.ReplicatedStorage.GetServer.OnServerEvent:Connect(function(plr, TBox) print("Yes") local Players = game:GetService("Players") local cache = {} function getUserIdFromUsername(name) local player = Players:FindFirstChild(name) if player then cache[name] = player.UserId return player.UserId end local id pcall(function () id = Players:GetUserIdFromNameAsync(name) end) cache[name] = id return id end local key = "ID-"..(getUserIdFromUsername(TBox)) if DataStoreService:GetAsync(key)==nil then return nil else local Data = DataStoreService:GetAsync(key) return(Data[1]) end end)
LocalScript
local TBox = script.Parent.EnterUser TBox.FocusLost:Connect(function(enterPressed, inputThatCausedFocusLost) print("Part1Complete") game.ReplicatedStorage.GetServer:FireServer(TBox.Text) end)
There is no errors in the Output, and the way I checked if the Server responds is with the Print() function
Well, I have a simple answer. When using RemoteEvents they can not return any values. But if you use a RemoteFunction you can freely return any value.
I can't provide you a modified version of your code due to the poor indentation.