Ight so im Trying to figure out what I can do with the Collection Service and I’ve tried a few things like instead of looping through every single object in the workspace to find a part to change its color I can just
get parts that are tagged something like “Rainbow”
Ive Made some Uses from what I have Tried doing so far and there is always some bug or problem and I want to know if these are me just not understanding how Service works
I’m not looking to get my code nitpicked or changed if any of the problems list with each code block is a different kind of problem you can just tell me that its not due to collection services
Rainbow Colored Items Controler - problem if i tag an instance that will be in replicated storage it seems to stop anything from happening
local CollectionService = game:GetService("CollectionService")
local RunServiceHeartbeat = game:GetService('RunService').Heartbeat
local RainbowParts = {}
for _, object in pairs(CollectionService:GetTagged("Rainbow")) do
RainbowParts[#RainbowParts + 1] = object
end
local speed = 1
coroutine.resume(coroutine.create(function()
while true do
for i = 0,1,0.001*speed do
local ComputedColor = Color3.fromHSV(i,1,1)
for A = 1,#RainbowParts do
RainbowParts[A].Color = ComputedColor
end
RunServiceHeartbeat:Wait()
end
end
end))
CollectionService:GetInstanceAddedSignal("Rainbow"):Connect(function(Object)
RainbowParts[#RainbowParts + 1] = Object
end)
CollectionService:GetInstanceRemovedSignal("Rainbow"):Connect(function(Object)
RainbowParts[Object] = nil
end)
CollectionService:GetInstanceAddedSignal("Rainbow")
CollectionService:GetInstanceRemovedSignal("Rainbow")
Then a weird script is made Add a mesh to brick than to scale the mesh negative this works perfectly on a players first instance in a server but then when they reconnect to the server it completely breaks
local CollectionService = game:GetService("CollectionService")
local ElectricWood = {}
local MeshSizer = require(script.Parent:WaitForChild("MeshSizer"))
for _, object in pairs(CollectionService:GetTagged("Void")) do
MeshSizer:ManageMeshSize(object)
end
CollectionService:GetInstanceAddedSignal("Void"):Connect(function(object)
if not object:FindFirstChild("Mesh") then
local Meshnew = script.Parent.Mesh:Clone()
Meshnew.Parent = object
MeshSizer:ManageMeshSize(object)
end
end)
CollectionService:GetInstanceAddedSignal("Void")
both above is a local script which can make perfect sense if you say the Void one shouldn’t be but im still wondering if there are any big known limitations or problems for this service