I'm trying to make a License Plate that generates a player username ID when they enter into a vehicle. I made a car already but just need this generator system to be connected to it. I believe the block of code is wrong because I see an error under local.
Please READ carefully..thank you!
LicensePlateGenerator
local function SurfaceGui()
script.Parent.Handle.SurfaceGui["Id:"].Identification.Text = game.Players.LocalPlayer.UserId
for i = 1, #pattern do
local c = string.sub(pattern, i, i)
if (c == "0") then
plate = plate..tostring(math.random(0,9))
elseif (c == "X") then
plate = plate..string.char(math.random(65,90))
else
plate = plate..c
end
end
for i,v in pairs(script.Parent.Plates:GetChildren()) do
v.SGUI.Identifier.Text = plate
end
script.Parent.Touched:Connect(function(hit))
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
script.Parent.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
script.Parent.Handle.SurfaceGui["Id:"].Identification.Text = game.Players[hit.Parent.Name]
for i = 1, #pattern do
local c = string.sub(pattern, i, i)
if (c == "0") then
plate = plate..tostring(math.random(0,9))
elseif (c == "X") then
plate = plate..string.char(math.random(65,90))
else
plate = plate..c
end
end
for i,v in pairs(script.Parent.Plates:GetChildren()) do
v.SGUI.Identifier.Text = plate
end
end
end
To get an idea of how my model looks. Go down to my comment and click the link. Hopes this helps below .. Thank you for your time..
Output
12:59:46.722 - Testing Car.rbxl auto-recovery file was created
12:59:53.397 - Workspace.License Plate.README:1: '=' expected near 'plate'
12:59:53.410 - Workspace.License Plates.LicensePlateGenerator:46: ')' expected (to close '(' at line 23) near '<eof>'
12:59:56.221 -
12:59:56.225 - [AC6.52S2]: Mass too high for specified weight.
12:59:56.227 - Target Mass: 60
12:59:56.229 - Current Mass: 69.67
12:59:56.231 - Reduce part size or axle density to achieve desired weight.

4 comments
https://i.gyazo.com/dbd3a21247cc467193e1277542f7a55c.png
i think it may be the unused local in line 2?
expected (to close '(' at line 23) near '' -- That means you need to close :Connect() using a ')' in line 43
Workspace.License Plate.README:1: '=' expected near 'plate' -- you have to either delete that variable or add an = to the 'plate' variable in line 1 of the read me script