Data does not get transmitted via RemoteEvent

Greetings,
the following issue includes two scripts.
The first script is a Server Script, which has the purpose of loading data from a Datastore and sending it via a Remote Event to a Local Script. Unfortunately the data, that the Local Script receives is printed as nil?

Server Script:

local CurrentSword = ReplicatedStorage:WaitForChild("CurrentSword")
local DatabaseModule = require(game:GetService("ServerScriptService"):WaitForChild("DatabaseModule"))

--#CURRENT SWORD#--
game.Players.PlayerAdded:Connect(function(Plr)
	CurrentSword:FireClient(Plr, DatabaseModule.LoadPlayerData(Plr, "SwordDatabase"))
    print(DatabaseModule.LoadPlayerData(Plr, "SwordDatabase"))
end)

Console Output:
https://i.gyazo.com/4c748ef95f1190fbcc5b2c9dd23bb47e.png

Local Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CurrentSelectedSword = ReplicatedStorage:FindFirstChild("CurrentSword")

CurrentSelectedSword.OnClientEvent:Connect(function(Sword)
	local CurrentDataBaseSword = game:GetService("ServerStorage"):FindFirstChild(Sword)
	print(CurrentDataBaseSword)
end)

Console Output:
https://i.gyazo.com/793b9629a16d7b0146705555f960d5e3.png

Issue:
As you can see the Data fired by the server does not get transmitted into the Local Script properly.

My attempts to fix:
I have tried using tostring() on this DatabaseModule.LoadPlayerData(Plr, "SwordDatabase") sadly that has not helped me at all.

Thank you for reading, I appreciate any help!

Oh well the data gets transmitted but the Sword cannot be found in the ServerStorage and I do not know why. I checked the name of the Sword in Server Storage and the name of the data.

I guess I fixed this. Pretty dumb mistake from my side I stored the swords in ServerStorage and tried calling them by a Local Script. I have put them in ReplicatedStorage and made the additional changes to my script and it now all works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.