I read the rules but, I need help I want to make a script that a player can vote to regen the model. When they are done destroying the model the poll pops up asking them do they want to regen the model. By the way i'm new here and new to scripting if someone could be so nice to help me i'll be grateful and i'll appreciate the person. Please :( I know this is breaking the rules but I'll only break the rules once I promise. Please :( don't be rude. Thanks!
Can someone help me i'm new to the scripting group? (Read desc)
1 answer
Scripting Helpers isn't a place for requests. However, I can point you in the right direction.
I want to make a script that a player can vote to regen the model. When they are done destroying the model the poll pops up asking them do they want to regen the model.
###Okay. Where do we start?
Firstly, we'll need some way of checking whether the model is destroyed or not. There's plenty of ways to do this, but I'm assuming you mean explosions are involved. Luckily, an Explosion has a Hit event that fires whenever a BasePart is within its BlastRadius. We can then keep track of every part within the model, and if it gets hit, mark it as destroyed. When x% of the model is "destroyed", vote to regen it.
To do this, we'd use a Table and Instance:GetDescendants to store all the parts and their corresponding Destruction Status™. Whenever the explosion's Hit event is fired, set that part's destroyed status to true. After some time, check if x/total parts are destroyed. If so, vote to regen.
Now we need a voting system. Luckily, we only need some user input (ex. from a TextButton), a RemoteEvent, and another table to store the responses. When the model is "destroyed", call RemoteEvent:FireAllClients() to send the signal to all clients. (On the client you're listening for RemoteEvent.OnClientEvent). If they click yes, send a signal to the server using RemoteEvent:FireServer() (on the server you listen for RemoteEvent.OnServerEvent). When the server receives your request, store the player inside a table and compare for later in case they try to vote a second time. If they're in the table, they can't vote, and therefore can't abuse the system by voting 17 times.
Next is to Clone the model from somewhere, like ReplicatedStorage and place it in Workspace. Whenever it gets destroyed (and the vote wins majority), destroy your copy of the model using model:Destroy() and make a new clone from your original model. Then, rinse and repeat.
If this sounds complicated and confusing, it's because it probably is for your level. I'd recommend starting off with baby steps rather than jumping right into it; it'll help you in the long run.
##I hope I helped! Best of luck on scripting!
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Please acknowledge that scripting helpers is a website designed for more skilled scripters to help people with errors and any problems that people encounter when trying to code. You aren't very likely to find anyone on here who is going to make a whole project for you or partner with you to make a project.
Sorry I don't know how to script do you have any website that could help me do a vote to regen gui?
Hey Bobthebuildbobb if you mean by health gui that works same as default health bar, you can visit DutchDeveloper YouTube video. Hope I helped you.
Vlade2003 nu I just need help making a vote to regen model poll gui I'm new to this "scripting" is there any youtube channel that does that if so please link it. It'll help out a lot thanks. :)