Output says lines of code need to have a parenthesis at a seemingly random point

I’m making a motivator in a deathrun game that follows a certain path around the map through different set points. I inserted a function that makes the motivator teleport to a certain part of the map after stepping on a certain part. It worked fine until I added another point succeeding the point that teleports the bot. For some reason it won’t let me use an event after I move the bot to the teleporting part. Not exactly sure how to explain. Here is the script.

A = game.Workspace.A.Position
B = game.Workspace.B.Position
C = game.Workspace.C.Position
D = game.Workspace.D.Position
E = game.Workspace.E.Position
F = game.Workspace.F.Position
G = game.Workspace.G.Position
H = game.Workspace.H.Position

Cpart = game.Workspace.C

sound = script.Parent.Torso.motivator
npc = script.Parent.Humanoid
torso = script.Parent.Torso

sound:Play()
npc:MoveTo(A)
npc.MoveToFinished:Wait()
npc:MoveTo(B)
npc.MoveToFinished:Wait()
npc:MoveTo(C)
npc.MoveToFinished:Wait()
npc:MoveTo(D)
npc:MoveToFinished:Wait() <--------- there is a red line below this colon
npc:MoveTo(E)
npc:MoveToFinished:Wait()

function onTouched(Part)
local tele = Instance.new(“Part”, game.Workspace)
tele.Anchored = true
tele.CanCollide = false
tele.Size = Vector3.new(2.4, 5.9, 2)
tele.Position = Vector3.new(707.719, 111.909, 173.873)
tele.Transparency = .5

tele.Touched:Connect(function(hit)
	print("Teleport")
	tele:Destroy()
	Cpart:Destroy()
	local Torso = hit.Parent:FindFirstChild("Torso")
	if Torso then
		Torso.CFrame = CFrame.new(631.198, 215.499, 343)
	end
end)

end

Cpart.Touched:Connect(onTouched)

1 Like

You have really inconsistent use of colons and periods in this block of code. That’s probably where the issue stems from.

1 Like

Shoot you’re right. I’ve been trying to crack this thing for a while and I guess when I analyzed those parts of the script my eyes just couldn’t detect the different little periods. I’ll have to increase my font size.