I’m scripting a GUI in a local script and I have a “rainbow button” (It’s a text button) that I want to tween the background color so it changes through different colors in a table. I already have set up and tested the code to tween the rainbow colors and it works perfectly… from the server.
My issue is that when I use collection service in the local script to tag the button it isn’t replicated to the server and therefore not tweened. So far I have only used CollectionService:AddTag().
I have theorized about using a remote event to pass the object to the server to have it be tagged and tweened but I am trying to avoid this as the remote event could be exposed to exploiters and I’m trying to make my game as server-sided as possible.
Here’s an example of what I’m currently using to test whether or not the tagged instances are replicated. So far it’s shown that they aren’t, but I need confirmation on whether or not this is true or if there is another way.
Local Script:
local CollectionService = game:GetService("CollectionService")
CollectionService:AddTag(workspace:WaitForChild("SpawnLocation"),"RainbowColor")
Server Script:
local CollectionService = game:GetService("CollectionService")
local TaggedRainbowObjects = {}
local function AddObject(object)
print('Added Rainbow object: "',object,'"')
table.insert(TaggedRainbowObjects,object)
print(CollectionService:GetTagged("RainbowColor")
end
local function RemoveObject(object)
print('Removed Rainbow object: "',object,'"')
table.remove(TaggedRainbowObjects,table.find(TaggedRainbowObjects,object))
print(CollectionService:GetTagged("RainbowColor")
end
CollectionService:GetInstanceAddedSignal("RainbowColor"):Connect(AddObject)
CollectionService:GetInstanceRemovedSignal("RainbowColor"):Connect(RemoveObject)
Note: I didn’t include the code for the rainbow tweening because it already works. This is just the method I’m using to try and detect replicated instances.
All I really need to know is if there is either a better way to script this and if tagged objects replicate from the client to server, as I haven’t found a single sentence denoting whether or not they do.