I’m currently working on an “ending system” for a game, where players have to bring multiple items (tools) to a specific spot (part) to complete the ending. Each ending would require 2-3 tools to be brought to the part. I’m able to make it work for each individual ending, but I thought I’d be better off making 1 script that handles all the endings in one place. My only issue is that I’m not too sure what the most efficient way of doing that would be.
My idea for the script is a system that would detect when a player touches a part (a goal) in the “goals” folder, then it would check whether or not they have a tool, and if it’s one of the correct tools for the goal. If the tool is one of the required tools, it would take the tool from the player and check if all other tools have been put into the goal part. If they have, the ending is complete, if not, it waits for the other tools.
I’ve made the system to detect when a player comes into contact with a goal, but now I’m stuck on how I would go about detecting if a player is holding a tool, and whether or not it’s the correct tool. Like I said, I’m trying to do this in one script so that other endings can easily be added without any edits done to the script.
Any ideas to help are greatly appreciated.