Skip to main content

IKService

This item only works when running on the server. Server

Handles the replication of inverse kinematics (IK) from clients to servers

  • Supports animation playback on top of existing animations
  • Battle-tested code
  • Handles streaming enabled
  • Supports NPCs
  • Client-side animations scale with distance
  • Client-side animations keep thinks silky
tip

Be sure to also initialize the client side service IKServiceClient on each client to make sure the IK works.

Functions

Init

IKService:Init(serviceBagServiceBag) → ()

Initializes the IKService. Should be done via the ServiceBag.

local serviceBag = require("ServiceBag").new()
serviceBag:GetService(require("IKService"))

serviceBag:Init()
serviceBag:Start()

Start

IKService:Start() → ()

Starts the IKService. Should be done via the ServiceBag.

GetRig

IKService:GetRig(humanoidHumanoid) → IKRig?

Retrieves an IKRig. Binds the rig if it isn't already bound.

PromiseRig

IKService:PromiseRig(humanoidHumanoid) → Promise<IKRig>

Retrieves an IKRig. Binds the rig if it isn't already bound.

RemoveRig

IKService:RemoveRig(humanoidHumanoid) → ()

Unbinds the rig from the humanoid.

UpdateServerRigTarget

IKService:UpdateServerRigTarget(
humanoidHumanoid,
targetVector3?
) → ()

Updates the ServerIKRig target for an NPC

local IKService = require("IKService")

-- Make the NPC look at a target
serviceBag:GetService(IKService):UpdateServerRigTarget(workspace.NPC.Humanoid, Vector3.zero)
Show raw api
{
    "functions": [
        {
            "name": "Init",
            "desc": "Initializes the IKService. Should be done via the ServiceBag.\n\n```lua\nlocal serviceBag = require(\"ServiceBag\").new()\nserviceBag:GetService(require(\"IKService\"))\n\nserviceBag:Init()\nserviceBag:Start()\n```",
            "params": [
                {
                    "name": "serviceBag",
                    "desc": "",
                    "lua_type": "ServiceBag"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 45,
                "path": "src/ik/src/Server/IKService.lua"
            }
        },
        {
            "name": "Start",
            "desc": "Starts the IKService. Should be done via the ServiceBag.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 62,
                "path": "src/ik/src/Server/IKService.lua"
            }
        },
        {
            "name": "GetRig",
            "desc": "Retrieves an IKRig. Binds the rig if it isn't already bound.",
            "params": [
                {
                    "name": "humanoid",
                    "desc": "",
                    "lua_type": "Humanoid"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "IKRig?"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 87,
                "path": "src/ik/src/Server/IKService.lua"
            }
        },
        {
            "name": "PromiseRig",
            "desc": "Retrieves an IKRig. Binds the rig if it isn't already bound.",
            "params": [
                {
                    "name": "humanoid",
                    "desc": "",
                    "lua_type": "Humanoid"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<IKRig>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 96,
                "path": "src/ik/src/Server/IKService.lua"
            }
        },
        {
            "name": "RemoveRig",
            "desc": "Unbinds the rig from the humanoid.",
            "params": [
                {
                    "name": "humanoid",
                    "desc": "",
                    "lua_type": "Humanoid"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 107,
                "path": "src/ik/src/Server/IKService.lua"
            }
        },
        {
            "name": "UpdateServerRigTarget",
            "desc": "Updates the ServerIKRig target for an NPC\n\n```lua\nlocal IKService = require(\"IKService\")\n\n-- Make the NPC look at a target\nserviceBag:GetService(IKService):UpdateServerRigTarget(workspace.NPC.Humanoid, Vector3.zero)\n```",
            "params": [
                {
                    "name": "humanoid",
                    "desc": "",
                    "lua_type": "Humanoid"
                },
                {
                    "name": "target",
                    "desc": "",
                    "lua_type": "Vector3?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 126,
                "path": "src/ik/src/Server/IKService.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "IKService",
    "desc": "Handles the replication of inverse kinematics (IK) from clients to servers\n\n* Supports animation playback on top of existing animations\n* Battle-tested code\n* Handles streaming enabled\n* Supports NPCs\n* Client-side animations scale with distance\n* Client-side animations keep thinks silky\n\n:::tip\nBe sure to also initialize the client side service [IKServiceClient] on each\nclient to make sure the IK works.\n:::",
    "realm": [
        "Server"
    ],
    "source": {
        "line": 19,
        "path": "src/ik/src/Server/IKService.lua"
    }
}