How do I get IKControl to work?

I am kind of a starter and i made an animation with the popular animation plugin. I have an R6 humanoid and i made a walking animation. How do i get it to work?

3 Likes

IKControl isn’t really used for playing animations. In order to play an animation you need to play it from a script. IKControl is just used to make it so the object it is parented too goes towards another object.

4 Likes

Well, the plugin i used automatically turned the animation into IKControl with keyframes in it. What should i do then?

2 Likes

What plugin are you using? If it’s a random plugin then that is probably why it is doing that.

1 Like

Oh well i’m not sure if i should say that.

1 Like

Well I can’t help you if I can’t know what the plugin is because that is the cause of the issue.

Can i close the post and we can continue from private messages?

yeah we can do that but why is the plugin a secret?

You will understand when i message you lol.

I take it that the plugin is your own custom one?

I wouldn’t say that. That thing is definitely not mine.

I am so heavily confused with this situation ;-;

I can understand that yet i can’t say what i use.

1 Like

Here is the pathfinding script you needed.

local PathfindingService = game:GetService("PathfindingService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local path = PathfindingService:CreatePath()

local player = Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

local TEST_DESTINATION = Vector3.new(100, 0, 100)

local waypoints
local nextWaypointIndex
local reachedConnection
local blockedConnection

local function followPath(destination)
	-- Compute the path
	local success, errorMessage = pcall(function()
		path:ComputeAsync(character.PrimaryPart.Position, destination)
	end)

	if success and path.Status == Enum.PathStatus.Success then
		-- Get the path waypoints
		waypoints = path:GetWaypoints()

		-- Detect if path becomes blocked
		blockedConnection = path.Blocked:Connect(function(blockedWaypointIndex)
			-- Check if the obstacle is further down the path
			if blockedWaypointIndex >= nextWaypointIndex then
				-- Stop detecting path blockage until path is re-computed
				blockedConnection:Disconnect()
				-- Call function to re-compute new path
				followPath(destination)
			end
		end)

		-- Detect when movement to next waypoint is complete
		if not reachedConnection then
			reachedConnection = humanoid.MoveToFinished:Connect(function(reached)
				if reached and nextWaypointIndex < #waypoints then
					-- Increase waypoint index and move to next waypoint
					nextWaypointIndex += 1
					humanoid:MoveTo(waypoints[nextWaypointIndex].Position)
				else
					reachedConnection:Disconnect()
					blockedConnection:Disconnect()
				end
			end)
		end

		-- Initially move to second waypoint (first waypoint is path start; skip it)
		nextWaypointIndex = 2
		humanoid:MoveTo(waypoints[nextWaypointIndex].Position)
	else
		warn("Path not computed!", errorMessage)
	end
end

followPath(TEST_DESTINATION)
1 Like

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