Coroutine Help For My Script

  1. What do you want to achieve?

I want to achieve how to slow down a courtine and how to stop it

  1. What is the issue? Include screenshots / videos if possible!

even adding a 5 second wait it just waited for 5 seconds then started running quick

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

going into discord servers and asking for help

local HieHie = {}




function HieHie.IceBird(player, Part)
	
	local bodyvelocity = Instance.new("BodyVelocity", Part)
	bodyvelocity.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * 33
	bodyvelocity.MaxForce = Vector3.new(90000, 90000, 90000)
	
	
	local IceFloor = function()
		wait(.1)
		print("Running")
		local RayPosition = Part.Position
		local RayDirection = Part.Position * Vector3.new(0, 5, 0)
		local raycastresult = workspace:Raycast(RayPosition, RayDirection)
		
		if raycastresult then
			print("found")
		end
	end
	
	
	for count = 1, 25, 1 do
		wait(.3)
		local IceFloorThread = coroutine.wrap(IceFloor)
		IceFloorThread()
	end
end


return HieHie

1 Like