-
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:
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
-
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!