You can write your topic however you want, but you need to answer these questions:
What do you want to achieve?
Okay so i am trying to make a button that opens a door in 5 seconds and after that closes it.
What is the issue? Include screenshots / videos if possible!
It need to be a “group” button, so the button can only be used by those that are in the group, and if they are in the group the door will open and if not it cannot be opened.
What im trying to do here is that a personell of the group is a border controller, who has to open the door for people trying to pass through the border, and i want it so that group people and only group people can press that button. But the script i wrote does not work, it has to turn invisible and can collide set to false. thats what im struggling with
local door = --put the location of the door here
local button = --put the location of the button here
local click_detector = --put the location of the ClickDetector here
button[click_detector.Name].MouseClick:Connect(function(plr)
if plr:GetRankInGroup(group id here) >= 10 then
door.CanCollide = false
door.Transparency = .5
wait(5)
door.CanCollide = true
door.Transparency = 0
else
--you can do something here if you want
end
end)
-- this is a local script
button.Clicked:Connect(function()
game.ReplicatedStorage.NAME:FireServer() -- change NAME to the name of the remote event object that you put in replicated storage.
end)
The remote event then should send signal to a regular script that then should do its job ( I believe )
-- this is regular script
game.ReplicatedStorage.NAME.OnServerEvent:Connect(function() -- same name of remote event
-- blah blah blah, whatever you need to do you put here, in your case it would be
door.Transparency = ...
door.CanCollide = false
wait(5)
door.Transperency = ...
doort.CanCollide = true
-- be aware that there is no cooldown on button, because I was too lazy to do that.
-- Also not sure if this entire thing will work, but in my experience it does.
So in perspective, you use local script to get LocalPlayer group rank I think, then if the requirement is meant, the remote event is being fire, which then makes door work as you please.
Once again, it is really raw and will not work in the exact form as I gave you, you have to make some edits yourself. Also would recommend reading documentation about remote events.