I’m attempting to create a system where datastores are loaded, a RemoteEvent fires to the client, and then the UI changes depending on the value of the datastore, for example: ___ value is 1, so ___ UI becomes visible, etc. The problem is my local script doesn’t seem to be working. I’m sure my server script is working, as my values save as intended. I can send the local script below.
Local Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LocalPlayer = Players.LocalPlayer
local RemoteEvent = ReplicatedStorage.RemoteEvents.InventoryValuesFinishedLoading
local LockedFrame = script.Parent.LockedFrame
local UseButton = script.Parent.UseButton
RemoteEvent.OnClientEvent:Connect(function()
if LocalPlayer.Inventory.SparkleParticles.Value == 1 then
UseButton.Visible = true
LockedFrame.Visible = false
end
end)
There are no error messages, so I’m unsure of the issue here.
Either the server script isn’t firing the correct RemoteEvent, code yields before it even gets to fire, or the LocalScript does not run due to being in a service that doesn’t support local scripts (i.e. workspace/ServerScriptService).
Are there any ancestors, of the objects that you want to change the visibility of, that have the Visible property to off? Is the ScreenGui Enabled property set to true? Also, I’m assuming that you’re setting the SparkleParticles value through the server, so I suggest you pass it’s value through the RemoveEvent. If not that’s ok, the SparkleParticles value could also be changed only through the client, but either way, make sure to try printing the SparkleParticles value. It’s possible that the value is incorrect and that’s why nothing is happening. If the value is incorrect, make sure to fix it.
Either the server script isn’t firing the correct RemoteEvent, code yields before it even gets to fire, or the LocalScript does not run due to being in a service that doesn’t support local scripts (i.e. workspace/ServerScriptService).