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

expected 'end' (to close 'function' at line 17) got <eof> How do I fix this?

Asked by 4 years ago

--In this script is a series of defined variables --There are a lot of these variables and to keep things short and sweet I've omitted them from ------this question

Any help is much appreciated thanks guys

local function Start()
    local Dart = Instance.new('Part') do
    -- Set up the dart part
        Dart.Name = 'Dart'
        Dart.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before                                                     changing Size
        Dart.Size = dartsize
        Dart.CanCollide = false
    -- Add the mesh
        local mesh = Instance.new('SpecialMesh', Dart)
        mesh.MeshId = dartmesh
            mesh.Scale = meshscale
    -- Add a force   to counteract gravity
        local bodyForce = Instance.new('BodyForce', Dart)
        bodyForce.Name = 'Antigravity'
        bodyForce.force = Vector3.new(0, Dart:GetMass() * Gravity, 0)
        print("MeshCreated")
    end

local function Shoot(player,spawnPosition,tool)
        -- Create a clone of dart and set its color
        local dartClone = Dart:Clone()
        --game.Debris:AddItem(dartClone, 30)
        dartClone.BrickColor = BrickColor.new(33, 60, 122)
        -- Position the dart clone and launch!
        dartClone.CFrame = CFrame.new(spawnPosition.p, target) --NOTE: This must be done before assigning Parent
        dartClone.Velocity = dartClone.CFrame.lookVector * dart_SPEED --NOTE: This should be done before assigning Parent
        dartClone.Parent = game.Workspace       
    end
Start() 
Click.OnServerEvent:Connect(Shoot)

0
Have you tried: Reading the error? Fifkee 2017 — 4y
0
Yup ExHydraboy 30 — 4y

3 answers

Log in to vote
0
Answered by
3wdo 198
4 years ago

put a end on line 18 with a end) so it would be like

local function Start()
    local Dart = Instance.new('Part') do
    -- Set up the dart part
        Dart.Name = 'Dart'
        Dart.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before                                                     changing Size
        Dart.Size = dartsize
        Dart.CanCollide = false
    -- Add the mesh
        local mesh = Instance.new('SpecialMesh', Dart)
        mesh.MeshId = dartmesh
            mesh.Scale = meshscale
    -- Add a force   to counteract gravity
        local bodyForce = Instance.new('BodyForce', Dart)
        bodyForce.Name = 'Antigravity'
        bodyForce.force = Vector3.new(0, Dart:GetMass() * Gravity, 0)
        print("MeshCreated")
    end
end)
local function Shoot(player,spawnPosition,tool)
        -- Create a clone of dart and set its color
        local dartClone = Dart:Clone()
        --game.Debris:AddItem(dartClone, 30)
        dartClone.BrickColor = BrickColor.new(33, 60, 122)
        -- Position the dart clone and launch!
        dartClone.CFrame = CFrame.new(spawnPosition.p, target) --NOTE: This must be done before assigning Parent
        dartClone.Velocity = dartClone.CFrame.lookVector * dart_SPEED --NOTE: This should be done before assigning Parent
        dartClone.Parent = game.Workspace       
    end
Start() 
Click.OnServerEvent:Connect(Shoot)

Ad
Log in to vote
0
Answered by 4 years ago

put an end at line 18

0
I could do that but it creates more errors in its place and the variables offset the code lines ExHydraboy 30 — 4y
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Solution: I put end at line 18 and it solved the initial issue. Thanks @newton162 and @AlbertoMiAmigo2.

Note: The issue was actually some misplaced variables.

Answer this question