Help with my flower

I completely disagree with this message, why would you not try something new? I don’t see the point in dissing a new developer who is clearly not very experienced and it’s quite pathetic that this forum has come to be this way. Who remembers when people would actually give constructive criticism and helped others out instead of disrespecting them?

16 Likes

These comments are absolutely gut-wrenching, it’s alright to give constructive criticism, but you guys need to accept he’s a beginner, put yourself in his shoes and think if a bunch of people is coming after you with these comments, would you be motivated to continue? Of course, not, wake up and realize not everyone is on the same level as you, teach them and they’ll get better - as the quote goes "Give a man a fish and you’ve fed him for a day, teach a man to fish and you’ve fed him for a lifetime.

With that being said, Stanny there is something called a “for loop” and it would loop through an array/table/folder, etc. This helps a ton and reduces the lines of code needed, stay grinding and don’t listen to them, you got this! :muscle:t4: :muscle:t4:

27 Likes

Love it when self proclaimed game devs and programmers who haven’t done jack talk down to others like they’re some hot shot. Everyone starts here, he’ll be writing circles around you in no time.

24 Likes

You really are toxic person. Everyone starts from somewhere, instead of disrespecting a beginner we should respect them and teach them nicely. You started off as a bad programmer once, stop being disrespectful.

11 Likes

The disrespect is an atrocity buddy.

5 Likes

Hey instead of using 172 tweens which can cause massive issues such as memory issues, you might want to try using Animations for this.

You can checkout this dev hub post on how to do animations on models without humanoids

6 Likes

Even though I’m not a programmer myself, I’m so sorry about all these replies. They are so disrespectful. Please ignore all the disrespectful replies. This is a Help and Feedback topic, I was expecting people to help you but instead, they just disrespect you like this. I’m very sorry about this. Every beginner has starts somewhere! Of course you will make mistakes along the way but you can fix that with the help of other people! :smiley:

Once again, I’m so sorry for all these disrespectful comments! Don’t let them demotivate you, just ignore them and continue to learn with the help of other developers! ^-^
You can ask for help anytime and our community will try our best to help you!!!

20 Likes

Are you trying to tween all of the flowers?
This would be better with loops. With this loop, you can iterate through all children inside of a folder, like so:

for index, child in pairs(workspace.MyFlowers:GetChildren()) do
    print(child.Name)
end

this prints every single child’s name inside of the workspace.MyFlowers folder.
the GetChildren() function returns a table with all the children of the instance you give it, and the loop runs through all of them individually.

you can use a table to store all of the tweeninfos you want. like so:

local infos = {
    Info1 = TweenInfo.new(); -- change to your liking
    Info2 = TweenInfo.new(); -- remember the ; though
    Info3 = TweenInfo.new(); -- etc etc
}

you can do the same with the tween goals

local goals = {
   Goal1 = {Transparency = 1}; -- change to your liking
   Goal2 = {CanCollide = false}; -- remember the ;
   Goal3 = {Color = Color3.fromRGB(255, 255, 255)}; -- etc etc
}

Now its time to loop through all the parts and apply the tween to them.
We’ll use the for loop again and loop through the parts in your folder.

for _, part in pairs(workspace.MyFlowers:GetChildren()) do -- loop through all the children
   -- now we are going to loop through all of the info and goals

    for _, info in pairs(infos) do
       -- this will loop through all of the infos we have
       -- bare with me there are a lot of loops
        for _, goal in pairs(goals) do
            -- now we have looped thorough all of the assets
            tweenService:Create(part, info, goal)
            -- this tweens each part with each info and goal
        end
    end
end

Now I’m not sure if this is what you wanted but I hope it helps. There is probably a better way to do this but idk. Feel free to ask any other questions if you need

Bassically, you give the loop at list of items and it will run individually for each item in the list which you can change properties for all of them.

local items = {
    "Test1";
    "Test2";
    "Test3"; -- always remember the ; though (you dont need it on the last one)
}

-- you can name index or item whatever you want, but item is the most important
for index, item in pairs(items) do
    print(item) 
    -- this will print Test1 and then Test2 and then Test3 etc etc
    -- then you can change each item for example
    item = 1 -- this makes every item in the list = to 1
end

You can check out more about loops here

23 Likes

The best thing to shorten code like this would be to just use a for loop to run through the children of an instance and run the specified code on them. For example

for _, flowerPart in pairs(WhiteFlower:GetChildren()) do
    TweenService:Create(flowerPart, tweenInfo, tweenGoal)
    -- other code you wish to run on said child
end

And instead of tweens you could also use an animation which would probably be easier on memory.
(I believe this would help for that Animation | Roblox Creator Documentation)

But more importantly try not to kick yourself or feel bad about your code, I can guarantee you I had very similar practices when I was first learning!

As for many other people in this thread, please take into account that everybody has to start somewhere. Although you may not like the code you should not be making them feel bad about it, instead help them improve.

Anyways I hope I was able to help! :smiley:

2 Likes

Kinda sad that you have to address that it isn’t a joke tbh. I was in your position once, we all start somewhere. Don’t let the people who don’t know how to give proper feedback get to you. You’re asking for help and the fact that you’re being bombarded with hate because of a beginner mistake makes me beyond disgusted.

Now, for the feedback portion:

I’m thinking you might want to try out animations. There is a built-in animation editor you can use, here’s a link with a tutorial:

If you don’t want to use the built-in editor or want some more customizability, maybe check out Moon Animator. It has things like avatar importing and easing styles. Here’s a good resource you can use to get started:

If you are looking into creating custom rigs (like your flower), there are many options. I personally use RigEdit. Here’s a link with a tutorial and docs:

Once you have your animation ID, you could probably do something like this:

local clickDetector = script.Parent.ClickDetector
local flower = script.Parent -- wherever your flower model is
local animationController = flower.AnimationController -- wherever the animationcontroller is

local animator = Instance.new('Animator') -- create an animator, this basically allows the animation to happen
animator.Parent = animationController

local myFlowerAnimationID = 123456 -- your flower animation ID
local myFlowerAnimation = Instance.new('Animation')
myFlowerAnimation.Parent = flower
myFlowerAnimation.AnimationId = 'rbxassetid://'..tostring(myFlowerAnimationID)

local animation = animator:LoadAnimation(myFlowerAnimation) -- this creates an AnimationTrack instance which we can use to play the animation

clickDetector.MouseClick:Connect(function(player)
    animation:Play()
end)

Anyway, the most important part of all of this is to not give up. We all have to start somewhere. You are a beginner, you’re asking for help and feedback which is what should have been given, not this.

Feel free to reach out if you need any help. I, as well as many others are here to help you if you need it!

: )

7 Likes

Also very sorry that this doesn’t help with the exact problem, I’m a little confused by what the original problem was :sweat_smile:

3 Likes

I feel mentally violated.

Incredible work!

4 Likes

Hey, If you are still having issues with this I would recommend this.

Looking at this part of your code,

wait(4)

ErrorTween:Play() print('It should do the tween now.')

Tween88:Play()

Tween89:Play()

Tween90:Play()

Tween91:Play()

Tween92:Play()

Tween93:Play()

Tween94:Play()

Tween95:Play()

Tween96:Play()

Tween97:Play()

Tween98:Play()

Tween99:Play()

Tween100:Play()

Tween101:Play()

Tween102:Play()

Tween103:Play()

Tween104:Play()

Tween105:Play()

Tween106:Play()

Tween107:Play()

Tween108:Play()

Tween109:Play()

ErrorTween, changed the transparency to 0, Tween109 changes the Transparency to 1. Tween109 plays right after ErrorTween. Try putting wait(2) between Tween108 and Tween109.

Hope this helps!

1 Like

Ah… finally, a challenge.

Okay jokes aside, don’t feel disheartened because of some of the replies in this thread.

It’s awesome that you’re learning to script, and it’s even better that you’ve detected the flaws in your code.

The code is “long”, and “messy” - yep!

So what can you do about this? I recommend that you check out something called a “for loop”, and something called a “function.”

Bugs and errors like the one you mentioned are abundant and making “long and messy” code only exacerbates the issue.

By learning how to use for loops and functions effectively, you’ll be able to weed out the bugs, and you’ll also become a better scripter in the process!

I’m glad to see you’re learning how to script - it takes determination and perseverance.

Best of luck!

10 Likes

I’ve read the replies on this topic. It’s sad to see how many people ignore the concept of constructive criticism, they help the OP, yes, but they also insult the poster, which is what you don’t want to do.

Stop, everyone starts as a beginner, nobody will bloody want to learn anything or join a community if a large part of the community is negative towards beginner’s. Stop, just stop.

Instead, add words of encouragement with your criticism and help. Saying things like “this makes me want to cry,” or just talking with the manner of “smh, this dude is such a noob lol” is not right.

The Developer Forum was made in order to help everyone, especially beginners.

8 Likes

Screw all of these comments, seriously. I’ve never seen a larger group of people be so confidently incorrect and demeaning in my life besides when I play Rainbow Six.

As @Cristiano100 and @kz99 point out, animations may be the best alternative if you are trying to do a lot of movement operations on an object. There are plenty of tutorials on how to rig and animate a model.

6 Likes

This is pretty good for beginner code! One suggestion I would make is to clean the code up a little. People have been extremely rude about this, but in all honesty they probably weren’t any better when they started. Don’t let them discourage you and keep on trying! :smiley:

4 Likes

I barely know anything about programming, but what I do know is you should never let people stop you from trying something new or doing something you enjoy. Don’t even pay attention to the rude comments, everyone starts somewhere and the same went for them. No one’s a star overnight, don’t let anyone discourage you and you’ll shine bright like one. I wish you the best of luck in your future projects and endeavors.

POV: You’re here from twitter
Also keep up the good work bud! Don’t be afraid to ask questions now cus of these guys.

4 Likes

His code is hard to read, yeah, but you guys should actually give a try at helping him instead of just talking about how bad it is.

He’s a BEGINNER, he will make mistakes. He wouldn’t be here asking a question if he knew everything about scripting.

Anyway, don’t use tweens for this. Animations are the way to go. Someone else commented this and described how to use AnimationController.

1 Like