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.
-- last portion of the code for i,v in pairs(script.Parent.Plates:GetChildren()) do v.SGUI.Identifier.Text = plate end end end
In here, you need to close the function in line 23 aka..
script.Parent.Touched:Connect(function(hit) -- needs a ) after the 'end'
So it should be...
-- last portion of the code for i,v in pairs(script.Parent.Plates:GetChildren()) do v.SGUI.Identifier.Text = plate end end end) -- Add a ')'
Also in the README
script, add an '=' in the first line after that variable or whatever you had.