Cannot resume non-suspended coroutine

for some reason, doing script.Parent.Equipped:Wait() in a while true do loop gives the error

cannot resume non-suspended coroutine 

Why is this happening and how do I fix this?

Hello everyone, I still cannot figure out why this happening. I would really appreciate it if anyone could help me.

Why are you doing script.Parent.Equipped:Wait()?

Can you show your script?

quite inefficient but I still wonder why it doesn’t work:

while true do
	wait()
	script.Parent.Equipped:Wait()
	local newCFrame = CFrame.Angles(0, math.rad(90), 0)
	local offset = Vector3.new(0, 0,-11)
	
	local params = RaycastParams.new()
	params.IgnoreWater = false
	params.FilterDescendantsInstances = {game.Workspace.Terrain}
	params.FilterType = Enum.RaycastFilterType.Whitelist

	local raycast = workspace:Raycast(Vector3.new(Furnace.PrimaryPart.Position.X,Furnace.PrimaryPart.Position.Y + 70,Furnace.PrimaryPart.Position.Z),Vector3.new(0,-500,0),params)
	
	
	
	local rootpartFrame = character.HumanoidRootPart.CFrame
	local rotation = rootpartFrame - rootpartFrame.Position
	local CompleteCFrame = rotation +  Vector3.new(rootpartFrame.X, raycast.Position.Y + 4, rootpartFrame.Z) 
	furnace:SetPrimaryPartCFrame(CompleteCFrame*CFrame.new(offset)) 
	furnace:SetPrimaryPartCFrame(furnace:GetPrimaryPartCFrame() * newCFrame)


end

(It shows where the furnace would be placed if the player were to click, I am replacing it from repeat wait() until script.Parent.Equipped)

Could be due to the wait() since you are trying to do script.Parent.Equipped:Wait()

One Example:

local RS = game:GetService("RunService")

while true do
RS.RenderStepped:Wait()
print("Frame")
end

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