For some reason, if I try to fire the ‘EnterCar’ function immediately after the tag is created, it returns saying that the car has 0 tags. Even tho it prints ‘Add tag to NinjoOnline Vehicle’ before it gets the total tags. Can see it sometimes prints correctly, showing 2 tags. But I keep getting times when it returns 0, usually when I try entering the car as soon as it spawns
-- Add tag
local function AddTag(object, tagType)
print("Add tag to", object, tagType)
CollectionService:AddTag(object, 'Interaction')
CollectionService:AddTag(object, tagType)
end
function EnterCar()
print("InteractingObject =", InteractingObject)
-- Get the objects tags
local Tags = CollectionService:GetTags(InteractingObject)
print("Total tags =", #Tags)
-- Find the specific tag
local Tag
for i, v in pairs(CollectionService:GetTags(InteractingObject)) do
if v ~= 'Interaction' then
Tag = v
end
end
print(Tag)
end
VehicleHolder.ChildAdded:Connect(function(child)
AddTag(child, 'Vehicle')
end)
Output
Add tag to NinjoOnline Vehicle
InteractingObject = NinjoOnline
Add tag to NinjoOnline Vehicle
InteractingObject = NinjoOnline
Video shows for the most part, it works. But it’s when I try to be fast, it’s like the tags haven’t loaded on the vehicle model yet, even tho it prints saying it’s added the tags before anything else