Help with Sign's attributes from ReplicatedStorage(Module Script) to Client

  1. What do you want to achieve?
    I’m making signs for my game. You use a proximity prompt and then you get a UI popup with the text the sign reads using an attribute.
    This is what the attributes look like on each sign:
    image

When I playtest my game the UI popup appears and tweens. But, the text label doesn’t display any text for the ‘Text’ attribute, which is supposed to be on the popup, changing the text label to the attribute. Oh btw whenever i plugged in the :GetDescendants() loop, it renders the first sign’s text and then flashes to the other one’s text(i have two signs in my game currently for testing)

I believe that both the module and the client are running the loop:

_, v in pairs(workspace:GetDescendants()) do

and are intertwining with each other in a thread or something like that

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried removing getDescendants() in a _, v in pairs() loop but haven’t figured out a way to get the text attribute

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

This is my code for the module script(only the part that sends the data and the :GetDescendants())

for _, v in pairs(workspace:GetDescendants()) do
	if v:GetAttribute('InteractSign') then
		local debounce = false
		local sound = script:WaitForChild('SignInteract')
			
		local prompt = v.Handle.ProximityPrompt
		prompt.ActionText = 'Interact with Sign'

		prompt.Triggered:Connect(function(plr)
			if not debounce then
				debounce = true
				sound:Play()
					
				signEvent:FireAllClients()
					
				print(v:GetAttribute('Text'))
				task.wait(0.01)
			end
				
			task.wait(debounceTime)
			debounce = false
		end)
	end
end

and here’s my code for the client script(located in starterGui):

local RES = game:GetService('ReplicatedStorage')
local signEvent = RES.Client.Remotes.Manager:WaitForChild('SignEvent')

local plr = game.Players.LocalPlayer

signEvent.OnClientEvent:Connect(function(...)
	for _, v in pairs(workspace:GetDescendants()) do
		if v:GetAttribute('InteractSign') then
			local temporaryGui = plr:WaitForChild('PlayerGui'):WaitForChild('Temporary')
			temporaryGui:WaitForChild('sign_frm'):TweenPosition(
				UDim2.new(0.5,0,0.85,0),
				Enum.EasingDirection.InOut,
				Enum.EasingStyle.Quart,
				0.5,
				false
			)

			task.wait(1) -- dopo questo(after this task.wait()): temporaryGui:WaitForChild('sign_frm'):WaitForChild('TextLabel').Text = ...:GetAttribute('Text')

			temporaryGui:WaitForChild('sign_frm'):TweenPosition(
				UDim2.new(0.5, 0,2, 0),
				Enum.EasingDirection.InOut,
				Enum.EasingStyle.Quart,
				0.5,
				false
			)
		end
	end
	
	--temporaryGui:WaitForChild('sign_frm'):WaitForChild('TextLabel').Text = 
end)

Thank you!

You shouldn’t need the servers involvement with this proximity prompts at all. This can all be done on the client. Also I don’t see any place where you are setting the GUI pop-up text to match the attribute you have set on the prompt object.

i want to use a module script because i’m going to have multiple signs in the game and i thought it would be best to organize it(i’ve done it for items, money, and doors)

and also i put in a comment where i want to set the text to the attribute after the task.wait()

...
task.wait(1) -- dopo questo(after this task.wait()): temporaryGui:WaitForChild('sign_frm'):WaitForChild('TextLabel').Text = ...:GetAttribute('Text')

			temporaryGui:WaitForChild('sign_frm'):TweenPosition(
				UDim2.new(0.5, 0,2, 0),
				Enum.EasingDirection.InOut,
				Enum.EasingStyle.Quart,
				0.5,
				false
			)

You can use a module script from the client side.

i have it in replicated storage so i don’t see an issue with it replicating

I don’t understand. The proximity prompts are only relevant to the client using them. There is no need for the server to do anything. Even if the script was in replicated storage. The server would have its own “Copy” of that script and it would only run on the server. Each client would have their own “Copy” of the script that would only run on their side.

You should just create a module in “PlayerScripts” or something. That module can collect the prompts for each of the signs (manually or using collection service) and then when a client interacts with the prompt you tween the GUI for the client, you pop in the text stored on the sign/prompt obj attribute and thats all. Only the client using the prompt will see the GUI anyway.

Unless the signs are added dynamically into the game, there is no reason for them to be in replicated storage either.

Is the text for the sign changed dynamically? Or is the text preset from the start of the game? Only if the text is changed during runtime would you need to bother updating the client about it.