Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a brick grow then shrink then repeat?

Asked by 5 years ago

Ok so, I have this brick that grows & shrinks. The goal is it for this to repeatedly do this without any interference, but it seems after 10-15 minutes of the server being up the brick becomes far too large, and I can't seem to figure out why. Any help would be great. while true do

while true do

for i = 1, 15 do

script.Parent.Size = script.Parent.Size + Vector3.new (0.5, 0.5, 0)

wait(0.1)

end

for i = 1, 15 do

script.Parent.Size = script.Parent.Size + Vector3.new (-0.5, -0.5, 0)

wait(0.1)

end

end

1 answer

Log in to vote
0
Answered by
Divistern 127
5 years ago
Edited 5 years ago

You can do that easily by using TweenService and make it repeat from the TweenInfo itself you can do it like this;

Code: ``` local tweenService = game:GetService("TweenService") local part = script.Parent

local tweenInfo = TweenInfo.new( 2, --The time it would take to do the tween Enum.EasingStyle.Linear, --The style it would go about the tween Enum.EasingDirection.Out, --Where the tween will head to -1, --How many it will repeat, but when the number is under 0 or smaller than 0 it will loop forever true, --If it will repeat or not 0, --delay )

local tween = tweenService:Create(part, tweenInfo, {Size = Vector3.new(5,5,5)}) --Making the tween --The size being 5,5,5 means that the tween will make the part change it's size to 5,5,5 then return to the original

tween:Play() --and last part you start the tween, you could stop it after an amount of seconds if you want. wait(10) tween:Stop() ``` You could read more about tweens; https://developer.roblox.com/api-reference/class/TweenService

Hope this helped.

0
He's not using the TweenService... DeceptiveCaster 3761 — 5y
0
Also, for loops are ok, but repeat loops are better for this kind of thing. DeceptiveCaster 3761 — 5y
0
I'm telling him to use tweenservice, so its more easier for him Divistern 127 — 5y
0
I get an error on line 11 and have 0 clue how to fix it.. IPhoneDrew 9 — 5y
View all comments (3 more)
0
Send your code that had the error in another question. Divistern 127 — 5y
0
its the exact same one you posted IPhoneDrew 9 — 5y
0
Ok i'm very sorry for the earlier issue i wrote the code without testing it, i added an extra "," after the 0 and it was unneeded, it should work now Divistern 127 — 5y
Ad

Answer this question