Bindable Event not working?

I have this bindable event that tells me when the player’s data is loaded and then I use it for my settings gui, but for some reason the script inside the gui is not receiving the data or printing anything?

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local modules = ReplicatedStorage.Modules
local events = ReplicatedStorage.Events

events.BindableEvents.DataLoaded.Event:Connect(function()
	local fieldOfView = clientData.data.configurations.settings["Field Of View"]
	slider:OverrideValue(fieldOfView)
	valueLabel.Text = tostring(fieldOfView)
	currentCamera.FieldOfView = fieldOfView
end)

Client data receiving script (receives data from server)

events.RemoteEvents.SendData.OnClientEvent:Connect(function(data)
	clientData.data = data
	events.BindableEvents.DataLoaded:Fire()
end)

use remote event not bindable event

1 Like

It’s a bindable event to tell the other client scripts that the data has been loaded so there’s no errors when I’m accessing the data.

If I just used the SendData remote event as way to tell if the data has been loaded, it wouldn’t work because there’s a line here where I set the data of a module to the data that has been sent from the server.

clientData.data = data

Fixed, this is because it takes time for the script inside the gui to replicate, so using an event is a bad idea since it will not work if the event was already fired before the script itself loads, so I used an attribute that gets set to true instead and I wait for that attribute

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