How To MAKE A Tycoon Game in Roblox Studio | Part 6 - Animations!

Share

Summary

This video tutorial focuses on adding animations to buttons in a Roblox Tycoon game. It details how to implement a disappearing and reappearing animation for purchased items, using TweenService, various functions to manage object properties, and ultimately enhancing the visual feedback for players.

Highlights

Introduction to Button Animations00:00:00

The video introduces the goal of adding animations to buttons in a Roblox Tycoon game. When a player purchases an item with enough money, an animation will play for that item. The tutorial starts by opening the core script inside the tycoon to begin coding.

Initial Code Segment: Tween Service and Constants00:00:37

The first segment of code involves setting up TweenService for animations and creating a new random instance. Two constants, 'building animation position offset amount' and 'animation part delay', are defined to control animation settings. Users are encouraged to experiment with these values.

The 'hasProperty' Function00:01:23

This section explains the 'hasProperty' function, which checks if an object possesses a specific property. It takes an instance (object) and a property name (string) as inputs, validates their types, and attempts to retrieve the property's value using 'pcall' to prevent errors. It returns true if the object has the property, otherwise false.

The 'instanceListToPropertyDictionary' Function00:02:40

The video delves into the 'instanceListToPropertyDictionary' function. This function creates a dictionary mapping objects to their properties and values. It validates input types, iterates through a list of objects, and for each object, checks if it has the specified properties. If so, it adds the object and its properties to a dictionary.

The 'getDescendantsOfClass' Function00:05:29

This part covers the 'getDescendantsOfClass' function, which finds and collects all objects related to a particular ancestor object that belong to a specified class. It validates inputs, traverses the ancestor's descendants, and adds any objects matching the class name to a list, which is then returned.

The 'animateBuildingIn' Function00:07:07

The core animation logic is explained through the 'animateBuildingIn' function. This function animates models or objects by making their parts disappear and then reappear. It collects all parts of a building model, saves their original properties, makes them invisible and randomly repositioned, then animates them back to their original state using TweenService with a delay between each part.

Calling the Animation Function and Setting Primary Parts00:10:41

The video demonstrates how to call the 'animateBuildingIn' function within the button's functionality. When an item is added to the 'purchased items' folder (after a button press), the animation is triggered. Before testing, it's crucial to set a 'Primary Part' for all models in the 'purchased items' folder for the animation to work correctly.

Testing the Animation00:12:44

The tutorial concludes with a demonstration of the implemented animation. After claiming a tycoon and pressing a button, the purchased item appears with a 'wobbly' and scaling effect, showcasing the successful implementation of the animation.

Recently Summarized Articles

Loading...
How To MAKE A Tycoon Game in Roblox Studio | Part 6… | Shorty