I have this gui where players can customize the sign text of their vehicle. The problem? It makes the text blank instead of change it to what’s in the TextBox.
I have all the remote events and everything working, I know because if I use TextBox.PlaceholderText it changes the sign to the PlaceholderText but not when I use TextBox.Text
Thanks for any help!
LOCAL SCRIPT
local player = game.Players.LocalPlayer
local replicatedStorage = game:GetService('ReplicatedStorage')
local Event = game.ReplicatedStorage.RemoteEvents.VehicleSystem.EditSign
local Frame = script.Parent
local Send = Frame.Done
local TextBoxButton = Frame.Button
local TextBox = Frame.TextBox
local Remaining = Frame.LetterCountBar.Remaining.LetterCount
local RemainingBar = Frame.LetterCountBar.Remaining
local maxCharacters = 18
local debounce = false
TextBoxButton.MouseButton1Click:Connect(function()
if not debounce then
debounce = true
TextBox:CaptureFocus()
wait(0.01) debounce = false
end
end)
TextBox:GetPropertyChangedSignal('Text'):Connect(function() -- Ignore, just for a bar that shows how many characters the player is allowed
TextBox.Text = string.sub(TextBox.Text, 1, maxCharacters)
Remaining.Text = (maxCharacters - #TextBox.Text)
RemainingBar.Size = UDim2.new(#TextBox.Text/18, 0, 0, 10)
end)
Send.MouseButton1Click:Connect(function()
if not debounce then
debounce = true
if TextBox.Text ~= '' then
Event:FireServer(TextBox)
TextBox.Text = ''
end
wait(0.01) debounce = false
end
end)
SERVER SCRIPT
local Event = game.ReplicatedStorage.RemoteEvents.VehicleSystem.EditSign
local TextService = game:GetService("TextService")
Event.OnServerEvent:Connect(function(player,TextBox)
workspace.Vehicles[player.Name].TextSign.SurfaceGui.TextLabel.Text = TextBox.Text -- *The vehicle is named after the player who owns it*
end)