Hello!
I got a little problem
I’m making a 4 crystals is rotating around player
Well I make it but the tween are spamming and I don’t know how to prevent it
I tried do debaunce but when I did debaunce it was tweening everyone part slower
What I’m exactly doing is magic (yep)
Well I don’t know how to fix it
So I’m asking you if you can help me
There is needed resources you need to help me
Script
The script it server script!
game.Players.PlayerAdded:Connect(function(player)
wait(5)
for _,attch in pairs(game.ServerStorage.Attachments:GetChildren()) do
local Cloned = attch:Clone()
Cloned.Parent = player.Character.HumanoidRootPart
end
local CrystalFolder = Instance.new("Folder",player.Character)
local Cry1 = game.ServerStorage.Crystal:Clone()
local Cry2 = game.ServerStorage.Crystal:Clone()
local Cry3 = game.ServerStorage.Crystal:Clone()
local Cry4 = game.ServerStorage.Crystal:Clone()
CrystalFolder.Name = "Crystals"
Cry1.Parent = CrystalFolder
Cry2.Parent = CrystalFolder
Cry3.Parent = CrystalFolder
Cry4.Parent = CrystalFolder
local did = 1
for _,crystal in pairs(CrystalFolder:GetChildren()) do
crystal.Name = "Crystal"..did
crystal.Position = player.Character.HumanoidRootPart["Crystal"..did].WorldPosition
did = did + 1
end
local IsAlreadyTweening = false
while wait(0.001) do
if IsAlreadyTweening == false then
IsAlreadyTweening = true
local did = 1
for _,crystal in pairs(CrystalFolder:GetChildren()) do
crystal.Name = "Crystal"..did
local Tween = game:GetService("TweenService"):Create(crystal,TweenInfo.new(0.3,Enum.EasingStyle.Sine,Enum.EasingDirection.In),{Position = player.Character.HumanoidRootPart["Crystal"..did].WorldPosition},false)
did = did + 1
Tween:Play()
end
IsAlreadyTweening = false
end
end
end)
Result of that script
As you can see the tween is not smooth and look terrible!
https://www.dropbox.com/s/3yw9vb13m9l8fax/9L0t3UtKka.mp4?dl=0
Anyway thanks for reading and byee! <3