Making a sliding door when a certain group rank?
Hello there I am trying to make a door slide open when a certain rank is interacting with it. I tried this code but It didn't worked I tried true and false and it still did not work please help here is my code. Plus the group id is stored in numvalue "L". Sorry about too much lines I just need the group problem fixed.
01 | local MOVE_IN_BY = 0.25 |
06 | local model = script.Parent |
07 | local door = model.Door |
09 | door.PrimaryPart = door.Main |
11 | local doorcf = door.Main.CFrame |
12 | local doorX = door.Main.Size.x |
14 | local doorClosed = true |
15 | local doorMoving = false |
17 | for _,button in pairs (model:children()) do |
18 | game.Players.PlayerAdded:Connect( function (Player) |
19 | if Player:GetRankInGroup(script.Parent.Parent.GroupValues.CoreGroup.ID.L.Value) = = 255 then |
25 | if button.Name = = "Button" and button:FindFirstChild( "ClickDetector" ) then |
26 | button.ClickDetector.MouseClick:connect( function () |
27 | if doorMoving then return end |
29 | if TIME_OPEN = = 0 then |
31 | for i = 0 ,MOVE_IN_BY, 0.05 do |
32 | door:SetPrimaryPartCFrame(doorcf*CFrame.new( 0 , 0 ,-i)) |
36 | for i = 0 ,doorX-ROOM_LEFT, 0.05 do |
37 | door:SetPrimaryPartCFrame(doorcf*CFrame.new(i, 0 ,-MOVE_IN_BY)) |
40 | door:SetPrimaryPartCFrame(doorcf*CFrame.new(doorX-ROOM_LEFT, 0 ,-MOVE_IN_BY)) |
43 | for i = doorX-ROOM_LEFT, 0 ,- 0.05 do |
44 | door:SetPrimaryPartCFrame(doorcf*CFrame.new(i, 0 ,-MOVE_IN_BY)) |
48 | for i = MOVE_IN_BY, 0 ,- 0.05 do |
49 | door:SetPrimaryPartCFrame(doorcf*CFrame.new( 0 , 0 ,-i)) |
52 | door:SetPrimaryPartCFrame(doorcf) |
56 | for i = 0 ,MOVE_IN_BY, 0.05 do |
57 | door:SetPrimaryPartCFrame(doorcf*CFrame.new( 0 , 0 ,-i)) |
61 | for i = 0 ,doorX-ROOM_LEFT, 0.05 do |
62 | door:SetPrimaryPartCFrame(doorcf*CFrame.new(i, 0 ,-MOVE_IN_BY)) |
65 | door:SetPrimaryPartCFrame(doorcf*CFrame.new(doorX-ROOM_LEFT, 0 ,-MOVE_IN_BY)) |
67 | for i = doorX-ROOM_LEFT, 0 ,- 0.05 do |
68 | door:SetPrimaryPartCFrame(doorcf*CFrame.new(i, 0 ,-MOVE_IN_BY)) |
72 | for i = MOVE_IN_BY, 0 ,- 0.05 do |
73 | door:SetPrimaryPartCFrame(doorcf*CFrame.new( 0 , 0 ,-i)) |
76 | door:SetPrimaryPartCFrame(doorcf) |