I’m trying to make it so this door can only be controlled by certain players or if you have a group rank. Therefore anyone else cannot press the button.
Current Script:
local Service = game:GetService("TweenService")
local Gate = script.Parent.Parent.Door1
local Allowed = {
1614394440, 1287679593 -- your userID
}
local Info = TweenInfo.new(8)
script.Parent.ClickDetector.MouseClick:Connect(function(hit)
for i,v in pairs(Allowed) do
if hit.UserId == v then
print("allowed")
script.Parent.CanCollide = true
local Change = {Position = Vector3.new(69.135, 5.61, 91.85)}
local Tween = Service:Create(Gate, Info, Change)
Tween:Play()
end
end
end)
Fixed myself, if you are wondering. You gotta add something on the start.
local groupId = 7211189 --use your group id
local requiredRank = 3 --enter the required rank(like 255, for example)
local Service = game:GetService("TweenService")
local Gate = script.Parent.Parent.Door1
local Allowed = {
1614394440, 1287679593 -- your userID
}
local Info = TweenInfo.new(8)
script.Parent.ClickDetector.MouseClick:Connect(function(hit)
for i,v in pairs(Allowed) do
if hit.UserId == v then
print("allowed")
script.Parent.CanCollide = true
local Change = {Position = Vector3.new(69.135, 5.61, 91.85)}
local Tween = Service:Create(Gate, Info, Change)
Tween:Play()
end
end
end)