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