I have 4 buttons hidden around the map and I want to make it so that each button you click turns from green to red “indicating that you clicked it”, and when you click all 4 buttons, a specific part becomes un-cancollide and becomes transparent ONLY for the player who clicked all of the 4 buttons, how do I make such thing?
Uhh, local scripts don’t work in the workspace (unless in a character model)
On a local script (where idk, I normally put mine in starterGUI)
do this:
local Part1 = game:GetService('Workspace'):WaitForChild("Part1") --== Change this to what you want, and to the parts name
--== Then add all the other parts
local Door = game:GetService('Workspace'):WaitForChild('Door') --== This is the part that will un-cancollide and becomes transparent, name is optional
local checks = 0 --== This will be counting how many have been pressed
local function checkCount() --== Function for checking the counts (this is optional, if you want something else let me know)
if checks == 4 then
Door.Transparency = 0.5
Door.CanCollide = false
end
end
Part1.ClickDetector.MouseClick:Connect(function() --== Add this for each button
Part1.ClickDetector:Destroy() --== So it can't be pressed again
Part1.Color = Color3.fromRGB(189, 0, 0)
checks += 1 --== Counts that the player pressed a button
checkCount() --== Run this after each button is pressed or run it in a loop
end)
Hope this helps!
Edit: Just realized you wanted the color to change, just added it
1 Like
Thank you so much for this it worked perfectly! I was just wondering, is it possible to make it so that it makes a custom sound when all 4 buttons are clicked?
Make a variable for the sound (I am not too good with where it should be) maybe use instance.new and put it inside of the players HumanoidRootPart (so they hear it good)
Then Inside of the checkCount() function make it play, once its finished destroy or stop it
This might help
1 Like