Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get rid of this error for my License Plate System?

Asked by 5 years ago
Edited 5 years ago

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.

0
i think it may be the unused local in line 2? Fad99 286 — 5y
0
expected (to close '(' at line 23) near '<eof>' -- That means you need to close :Connect() using a ')' in line 43 mudathir2007 157 — 5y
0
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 mudathir2007 157 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
-- 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.

Ad

Answer this question