Hello I need help, I have a Suggestion box but i need to log the Suggestion because then I won’t be able to see the Suggestion. Can you please make it where I can see all the Suggestion, Thank you!
Local Script
This script send the value to Server Script Service, the is"named ''SuggestionManager"
script.Parent.Parent.done.MouseButton1Click:Connect(function()
local Suggestion = script.Parent.Text
game.ReplicatedStorage.Suggest:FireServer(Suggestion)
end)
Server Script Service script
This Script received the value & prints the value!
local player = game.Players.LocalPlayer
game.ReplicatedStorage.Suggest.OnServerEvent:Connect(function(Player, Suggestion)
print(Player, Suggestion)
end)
I don’t know why you are getting the localplayer in a server script, so that might cause an error. You are also printing the player instead of the player’s name.
So you want to save the the suggestions for future reference?
First you need a place to save your data, for this example we will be using a DataStoreService from my knowledge you can’t store data with ReplicatedStorage.
Go to your ServerScriptService and add this. local DataStoreService = game:GetService(“DataStoreService”)
local SuggestionsData = DataStoreService:GetDataStore(“Suggestions”)
Now when you get a suggestion you can save it to the SuggestionsData DataStore game.ReplicatedStorage.Suggest.OnServerEvent:Connect(function(Player, Suggestion)
SuggestionsData:SetAsync(Player.Name, Suggestion)
print(Player, Suggestion)
end)
Now when you want to read the Data you can use the SuggestionData DataStore local PlayerName = “PlayerNameGoesHere”
local Suggestion = SuggestionsData:GetAsync(PlayerName)
print(Suggestion)