I created a component for the player’s character and now, when I add a tag to the HumanoidRootPart of the character(using CollectionService), it does nothing. Should I rework the custom character? @sleitnick it would really help if you replied
You have to add the components after Knit is started with Component.Auto
(see Component | RbxUtil). This is what I did in the following code (I used roblox-ts, which means that it is in TypeScript).
import { Component, KnitServer as Knit } from "@rbxts/knit";
import { ReplicatedStorage, ServerScriptService } from "@rbxts/services";
Knit.Start().await();
Component.Auto(script.Parent.WaitForChild("Components"));
You should do this on both the server and the client. Note that Knit:Start()
returns a Promise.
I actually did that on the server-side, but I did not add any code on the client side just yet, what do you suggest me to add?
Edit: Also I think the problem is about using Collection Service, when I try to do it on Tag Editor, it works just fine
I believe that you need to start Knit on both the server and the client.
That is strange since the Tag Editor uses the CollectionService.
Yup. I happen to think that Knit uses the folders Tag Editor creates in ServerStorage.
Edit: Nope, doesn’t work
What does your code look like?
I’m assuming you mean the tagging script, so here it is:
local CollectionService = game:GetService("CollectionService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local char = LocalPlayer.Character
local humanoidrootpart = char:WaitForChild("HumanoidRootPart")
CollectionService:AddTag(humanoidrootpart, "Egg")
It’s a local script btw.
Edit: Also I printed out the tags the HumanoidRootPart has, and it shows that the HumanoidRootPart has an egg tag
Oh wait, you have to assign a tag from the server to load a server-side Knit component.
Yup, that works. Thank you so much!