The script is not disabled and it could be part of the collection service
Have you tried these methods yet?
In that case, the plugin is likely to be faulty in some way. Try selecting all of the starCirclet parts, and then executing this command in the studio command bar:
local selected = game:GetService("Selection"):Get()
local CS = game:GetService("CollectionService")
for _, obj in ipairs(selected) do
CS:AddTag(obj, "starCirclet")
end
Either the plugin is faulty, or thereās a typo in the tag name you gave them.
The plugin is not faulty I donāt think. Because I have another script that is using Collection Service but itās a server script in server script service.
Iāve tried it and it did print the code in the output but no errors and still didnāt work.
Iām quite confused as to how it doesnāt work. I added a tag to a part in workspace, and I ran this script:
-- Services
local CS = game:GetService("CollectionService")
-- Functions
local function partAdded(part)
print("found one!")
print(part)
end
-- Loops
for _, part in ipairs(CS:GetTagged("BluePart")) do
partAdded(part)
end
-- Event connections
CS:GetInstanceAddedSignal("BluePart"):Connect(partAdded)
And it printed what I expected.
Are you sure that the LocalScript is executing at all? Try putting a print
after the makePartSpin
function. Where is the LocalScript located? Mine was in StarterPlayerScripts.
Did you mannually tag it? Like use a script to tag it? I put the script in StarterPlayerScripts and it didnāt print for some reason.
Yeah, I ran this command (in the roblox studio command bar) while selecting the parts I wanted to tag:
-- Services
local CS = game:GetService("CollectionService")
local S = game:GetService("Selection")
-- Loops
for _, obj in ipairs(S:Get()) do
CS:AddTag(obj, "BluePart")
end
Huh- when I tag it mannually, it did print. I think there is a problem with the tag editor plugin. But the problem is, it doesnāt spin after itās taggedā¦
Weāre getting closer to the solution, which is good news
Try putting a print
in the while true do
loop. If nothing is printed, try replacing spawn
with:
coroutine.wrap(function()
end)() -- You need to call wrapped coroutines
Is this how you do it?
local CS = game:GetService("CollectionService")
local taggedParts = CS:GetTagged("starCirclet")
local function makePartSpin(part)
print(part)
coroutine.wrap(function()
while true do
part.CFrame *= CFrame.Angles(0, math.rad(0.3), 0)
wait()
end
end)()
end
for _, part in pairs(taggedParts) do
makePartSpin(part)
end
CS:GetInstanceAddedSignal("starCirclet"):Connect(makePartSpin)
Yes, that looks good. ā ā ā ā ā ā ā ā
Yes but I donāt think it spins, because it did print the object but it doesnāt spin
Try putting a print
inside of the while true do
loop to check whether or not the loop runs.
while true do
print("It's running!")
part.CFrame *= CFrame.Angles(0, math.rad(0.3), 0)
wait()
end
I would use tweens for this. They are much more performant, less buggy, and look smoother than using a loop.
local TweenService = game:GetService("TweenService")
local CollectionService = game:GetService("CollectionService")
local taggedParts = CollectionService:GetTagged("starCirclet")
function tween(object, info, property)
local tween = TweenService:Create(object, info, property)
tween:Play()
if info.RepeatCount ~= -1 then
delay((info.Time * (info.RepeatCount + 1)) + 1, function()
tween:Destroy()
end)
end
end
for _, part in pairs(taggedParts) do
tween(
part,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1), --time, easing style, easing direction, times to loop (-1 is infinite)
{CFrame = part.CFrame * CFrame.Angles(0, math.pi, 0)}
)
end
This by itself should work in a local script or a server script. Let me know if you have any issues.
This looks kind of colicated, can you just use like Tween Service? and somehow make it loop infinitly?
Thatās exactly what itās doing. The tween function just makes it simpler to use and it will loop infinitely.
I was going to suggest using an AngularVelocity object for this, because itās likely to be better for performance, however, the parts are probably anchored, making this not doable, and I thought I should work on getting the tagging to work.
I just now changed 2 * math.pi to math.pi so it would actually tween, so make sure you change that as well in your script or whatever you had originally if you use my solution.
Would this work?
I put it inside the same script that was doing the moving tween and just tag it
This script is a server sided script.
local tweenService = game:GetService("TweenService")
local part = script.Parent
local tweeninfo = TweenInfo.new(
2,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut,
-1,
true,
0
)
local rotatingInfo =
TweenInfo.new(
4,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
-1,
false,
0
)
local CS = game:GetService("CollectionService")
local taggedParts = CS:GetTagged("starCirclet")
for _, part in pairs(taggedParts) do
--Moving
local NewPosition = part.Position + Vector3.new(0,3,0)
local tween = tweenService:Create (part, tweeninfo, {Position = NewPosition})
tween:Play()
--Rotating
local goal = {
CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(180), 0)
}
local rotatingtween = tweenService:Create(part, rotatingInfo, goal)
rotatingtween:Play()
end