Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

--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)

2 comments

0

Have you tried: Reading the error?

0

Yup

3 answers

✓ Accepted answer

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)

put an end at line 18

1 comment

0

I could do that but it creates more errors in its place and the variables offset the code lines

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.