I am trying to have a module script that is in charge of my datastore fire a bindable vent when it is done retrieving data. This bindable event will then be picked up by server and client scripts to continue the game. However, it is not firing. The way I call it in my module script is like this;
local player_loaded = game.ReplicatedStorage.Events.PlayerLoaded
player_loaded:Fire()
and then in my client script I have this;
local function updateStatsUI()
local player = game.Players.LocalPlayer
local player_data = player.PlayerData
local money = player_data.PlayerMoney.Value
local bounty = player_data.PlayerBounty.Value
script.Parent.StatsFrame.Frame.Money_txt.Text = 'Money: '..money
script.Parent.StatsFrame.Frame.Bounty_txt.Text = 'Bounty: '..bounty
end
local player_loaded = player_loaded.Event:Connect(function()
updateStatsUI()
end)
Thank you I was looking through the documentation but must’ve missed this. This leads me now to another problem I cant fire server with a remote event on my module(it is being required through the server as well.)
The remote event instance should be located in a place where its replicated between the server and clients, i.e. ReplicatedStorage or workspace
it won’t work if it’s parented under something that won’t replicate (i.e. a client-sided modulescript)
No sorry for not clarifying I have stored my remote event in replicated storage. I am just calling the player_loaded:FireServer() from a module that is being required by a server script. However this will not work for some reason it seems that it never fires.
Can you show me the module?
Also, are you sure you’re firing the remote in the module? Simply requiring a module only gets what’s returned by the modulescript, it won’t necessarily run anything
Where exactly is this located? Is it inside a function which is then returned by the modulescript?
Also, it appears that you’re waiting for the client to fire the remote first; did you check to see if the client even fired it?
I’m sorry for wasting your time I have figured out the solution all I had to do was instead of using a remote event to fire back I just had to use the return of the module to execute code. Sorry again but you did help!