Spinning parts locally

I searched every where but can’t find a tutorial on how to spin parts locally. It would be really nice if somebody could give me hand. (I am not to good at scripting)

Question:
Could this be done using the collection service or some different thing I don’t know of?

1 Like

Use a local script thatl solve your problem.

Inside of the part? or somewhere else?

Inside of the part you want to spin

Uh wouldn’t that be too many scripts? I have quite a few parts I want to spin.

You’ll need a localscript for this.
PS: Localscripts do not run in workspace, you should find a suitable place for it (ex StarterPlayerScripts).

1 Like

Does collection service work in local scripts tho?

Does collection service work in local scripts?

yes it does collection service works in local scripts

Alright, I’ll try and see, Thanks.

Uh I am failing to rotate from a local script.

script:

local CollectionService = game:GetService("CollectionService")

local p = CollectionService:GetTagged("SpiningParts")

for _, p in pairs(p)do
	while true do
		p.Orientation = p.Orientation +10
	end
end

It is in starter character scripts.

local runService = game:GetService('RunService')
local folderToSpin = workspace.SpinFolder --replace with your folder
local spinAmount = Vector3.new(0, 15, 0) --how many degrees to spin per second

runService.Heartbeat:Connect(function(step) 
	for i,v in pairs(folderToSpin:GetChildren()) do
		v.Orientation += spinAmount*step --Replace X with your preferred axis.
		v.AssemblyAngularVelocity = spinAmount*step
	end
end)
2 Likes

Try this:

local CollectionService = game:GetService("CollectionService")

local p = CollectionService:GetTagged("SpiningParts")

for _, p in pairs(p)do
	while true do
		script.Parent.Orientation += Vector3.new(0, 1, 0)
		wait()
	end
end
1 Like

Your key word is “locally,” meaning you will use a LocalScript. As mentioned above, you can use collection service to get all of the instances, then do the same thing on the client as you would the server.

1 Like

This works but now I have a new problem

The player does not move with the part.

Video:
https://gyazo.com/6fce30e75be00189220c1cffb1237800

also found another problem with this script only 1 part spins

local CollectionService = game:GetService("CollectionService")
local PartCollection = CollectionService:GetTagged("SpiningParts")
local Stepped = game:GetService("RunService").Stepped

while Stepped:Wait() do
   for _, part in ipairs(PartCollection) do
      if part:IsA("BasePart") then
	     part.Orientation += Vector3.new(0, 1, 0)
      end
   end
end

This should fix the previously provided code from @NeonTaco135
I also just generally recommend using stepped in place of “wait()” due to reliability and stability. (RunService has many great events, some new ones are coming… eventually… wish they didn’t deprecate before the events were even usable…)

Got an error

Orientation is not a valid member of PlayerScripts "Players.Furkan5E.PlayerScripts"