I have this script (it’s a sample, not the real):
local texts = require(game:GetService("ReplicatedStorage"):WaitForChild("TextsModule"))
local barrier = workspace:WaitForChild("Barrier")
local textLabel = game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("GameGui"):WaitForChild("TextLabel")
barrier.Touched:Connect(function(part)
local player = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
if player == game:GetService("Players").LocalPlayer then
textLabel.Text = texts.TEST_1
end
end)
The module ‘texts’:
return {
TEST_1: "ciao come va?",
TEST_2: "bene e tu?"
}
As soon as I touch the barrier the text is actually shown, however after 5/6 touches the textlabel will become nil. If instead of using the text taken from the module I write a hardcoded string the problem does not occur.