Hello, I’ve made this script to manage the text on a sign although it has gotten inefficient as when new players join they have to update the text for it to show for them. Any help or suggestions on making this more server oriented will help.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local EditEvent = ReplicatedStorage.Events:FindFirstChild("EditEvent")
local UpdateText = ReplicatedStorage.Events:FindFirstChild("UpdateText")
local PromptEvent = ReplicatedStorage.Events:FindFirstChild("PromptEvent")
local ResetSignEvent = ReplicatedStorage.Events:FindFirstChild("ResetSignEvent")
local Sign = game.Workspace:FindFirstChild("Sign")
local SignText = Sign.Structure.Signs.TextSign.SurfaceGui:FindFirstChild("Text")
local EditPrompt = Sign.Structure.Prompt:FindFirstChild("Edit")
local EditFrame = Players.LocalPlayer.PlayerGui.Edit:FindFirstChild("Frame")
local Apply = EditFrame:FindFirstChild("Apply")
local Text = EditFrame:FindFirstChild("Text")
ResetSignEvent.OnClientEvent:Connect(function()
SignText.Text = "Your Text Here"
end)
PromptEvent.OnClientEvent:Connect(function(EditPrompt, Value)
EditPrompt.Enabled = Value
end)
EditEvent.OnClientEvent:Connect(function()
EditFrame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Sine", 0.5, true)
end)
Apply.MouseButton1Down:Connect(function()
UpdateText:FireServer(Text.Text)
end)
local function HandleTextUpdate(Owner, NewText)
if Owner and NewText then
SignText.Text = NewText
if Owner == Players.LocalPlayer then
EditFrame:TweenPosition(UDim2.fromScale(0.5,-1), "Out", "Sine", 0.5, true)
EditPrompt.Enabled = true
end
end
end
UpdateText.OnClientEvent:Connect(HandleTextUpdate)
