Im trying to make it so that a part’s position is equal to a part in the workspace named “player”, but after the first time I set it, when it gets to the repeat loop, it doesn’t change its position at all.
there aren’t any errors in the output.
repeat
clonedAttack.Position = game.Workspace:WaitForChild("playerModel").Position
until task.wait(clockIn)
for i = 1, 5 do
task.wait(0.001)
clonedAttack.Transparency -= 0.1
clonedAttack.Position = game.Workspace:WaitForChild("playerModel").Position
clonedAttack.Anchored = true
end
task.wait(clockOut)
for i = 1,20 do
task.wait(0.001)
clonedAttack.Transparency += 0.05
clonedAttack.CanCollide = false
end
clonedAttack:Destroy()
Tweening isn’t required at all though, and I don’t even want to yield the script because it will not even make my game playable since it’s a bullet hell Rythm game
All Im doing is moving the position of the part to a part cald “playerModel”
If you don’t want your script to yield, then you could use coroutines. Coroutines are basically threads that can run at the same time.
Otherwise, if you want them to always be in the same position you could weld them.
if you want to constantly update a position of 1 part to another an easy way to do this is propertychangedsignal doing something like this
setup 2 parts in workspace 1 called part1 and other part2 use the below in a local script and move the other part manually or with a script, it will update part1 pos to part 2 everytime part2 position changes
Personally, I don’t like to always use tween service to make a part smooth since it takes more code which would make it increasingly harder for me to digest the script If I need some changes.
Also, its not like for loops are broken or all of the sudden deprecated, I just want to know how to fix it in my strategy.