Tween info can be defined outside of the loop as that information is just a part of the tween you’re creating. While you are correct that -1 will infinitely rotate it, this only holds true if the tween itself isn’t canceled.
You could insert a bodygyro inside of the coins to keep it from going upside-down, then put a BodyAngularVelocity inside the part, to make it spin. (So that way you don’t have to script it) If you need an example of how this could be done, then let me know, an I will give you an rbxm / rbxl file to help.
Yes an example would help, and I also need to avoid lag, so with 110 coins in the game, with a bodyang+vel in each of them, would it be as smooth as possible?
In my personal opinion tweeting them on the client is the most performant way of doing it. You’ve been given the tools to fix up your script with tween service.
hmm…But isnt tweening in a local script better than that, or is it just the same?
I believe you have two options; tweening or possibly using the BodyGyro method and creating them from a local script in each new child. I would say that tweening is probably a bit easier. If you need an example I can provide one later.
for tweening i’d like to see, or by what you said, using local scripts in every of them to create and instance BodyGyro and setting it there,or if possible then somehow get children and assign it a variable , c for example .Then do something like
local c = game.Workspace.Seatandpartfolder:GetChildren(v)
local b = Instance.new("BodyGyro")
b.P = 10
for v in pairs do
b.Parent = c
end
why won’t this work?
I fixed up the script you posted earlier using TweenService
. This LocalScript
should go inside of StarterPlayerScripts
as it only needs to be executed when the player joins.
local TweenService = game:GetService("TweenService")
local coins = workspace:WaitForChild("coinsfold")
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, false, 0)
-- Connect to ChildAdded so that any new items have the tween applied
coins.ChildAdded:Connect(function(coin)
local tween = TweenService:Create(coin, tweenInfo, {Orientation = Vector3.new(0, 360, 0)})
tween:Play()
end)
Also, the problem with what you’ve posted above is mostly due to the fact you didn’t properly set up the for loop, and new coins won’t be recognized. If you have any further questions don’t hesitate to ask!