I'm testing this, because previously I tried to return a value from a table that's stored inside a datastore, but it kept on returning nil aswell. But right now, it's just supposed to return a simple string. I have no idea why this happens.
LocalScript:
local plr = game.Players.LocalPlayer wait(1) local text = game.Lighting.Remotes.GetName:FireServer(script.Parent.Slot.Value) wait(1) print(text)
ServerScript:
game.Lighting.Remotes.GetName.OnServerEvent:connect(function(plr, slot) local ds = game:GetService("DataStoreService"):GetDataStore("datastore["..slot.."]"..plr.UserId) local key = "key"..plr.UserId ds:GetAsync(key) return "Test" end)
If you want to return a value from the server side to the local script while the game has FilteringEnabled set to true you should try a RemoteFunction instead of an Event. "The primary difference is that RemoteFunctions allow a value to be returned after the function call, which allows for communication back to the server or client."