My code just stops working till a certain point

my code stops working up before the pickStarter(true)
idk what’s going on

local function touchEvent(eventName, part, completeOnTouch, eventFn)
		if eventName and completedEvents[eventName] then return end
		local cn; cn = part.Touched:connect(function(p)
			if not p or not p.Parent or players:GetPlayerFromCharacter(p.Parent) ~= _p.player then return end
			cn:disconnect()
			if eventName and completedEvents[eventName] then return end
			if eventName and completeOnTouch then
				
			end
			eventFn()
		end)
	end

local function pickStarter(original)
	local starter = true
	local tweeninfo = TweenInfo.new(.75,Enum.EasingStyle.Quad, 
        Enum.EasingDirection.InOut,0, false,0)
	print("played")
	tweenService:Create(gui.StarterUI.MainFrame.UIGradient, tweeninfo, {Offset = Vector2.new(1,0)}):Play()
tweenService:Create(gui.StarterUI.MainFrame.UIStroke.UIGradient, tweeninfo, {Offset = Vector2.new(1,0)}):Play()
	--return starter
end
			
touchEvent('chooseStarter', room.cutsceneTrigger,false, function()
	_p.Players:playerOFF()
	char.Humanoid:MoveTo(room.playerPos.Position)
	char.Humanoid.MoveToFinished:Wait()
				
	_p.Players:LookAt(prof:WaitForChild("Head").Position,.3)
				
	_p.NPCchat:say(prof,'Ah, you must be the new trainer welcome to the lab!', 
	'Your name is '.._p.PlayerData.Data.trainerName..' correct?',
	'Well then I assume you\'ve been dreaming about this with your friend Sonny for awhile now!',
	'Before I am able to give you your first Cubelmon you must know a few things.',
	'Cubelmons are our friends! We need to protect them and they protect us, they are friends who we must take care of.',
	'Cubelmons can also fight! If you level up your Cubelmon enough you\'ll be able to take on different Battle Districts and earn badges by defeating the Master there!',
	'If you\'re really strong then in the future you\'ll be able to take on the Strongest Four in Finalis City!',
	'I\'ve talked for way too long now. I\'ll let you pick your very own Cubelmon now!'
	)
	_p.NPCchat:say(rival, "Heck yeah! I can't wait to see our options!")
	char.Humanoid:MoveTo(room.player2Pos.Position)
	_p.NPC:WalkTo(rival,room.sonny2CFrame.Position)
	char.Humanoid.MoveToFinished:Wait()
				
	_p.NPCchat:LookAt(rival,room.sonny2CFrame.Position)
	_p.Players:LookAt(room.player2Pos.Position,.3)
	-- where it stops running anything after
	local starter = pickStarter(true)
				
				
end)
1 Like

Are there any errors in the output?

1 Like

sorry i figured it out, the wait for the humanoid to finish walking activates AFTER the player finishes walking so there’s no point :melting_face:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.