| |
|
»
»
|
|
| |
Re: Need help with an admin click door
|
|
|
|
| 21 Feb 2013 03:19 PM |
I made a sliding door where when the admin clicks the button, the door slides open and if an admin clicks the button again, the door closes. Nothing happens if a non admin clicks the door.
The door works perfectly but I'm having problems making it so only admins can click it.
Script:
admins = {"Pikachucyndaquil","Player1"}
door = script.Parent door1 = door.Door1 door2 = door.Door2 Part1 = script.Parent.Part1 Part2 = script.Parent.Part2 Part3 = script.Parent.Part3 Part4 = script.Parent.Part4 Part5 = script.Parent.Part5 Part6 = script.Parent.Part6 button = door.Button isopen = door.IsOpen debounce = door.Debounce
button.ClickDetector.MouseClick:connect(function() for i, v in pairs(admins) do if (debounce.Value == false) then if (isopen.Value == true) then isopen.Value = false elseif (isopen.Value == false) then isopen.Value = true end button.BrickColor = BrickColor.new("Bright yellow") end end end)
isopen.Changed:connect(function() for i, v in pairs(admins) do if (debounce.Value == false) then debounce.Value = true if (isopen.Value == true) then script.Parent.Open:Play() for i=1, 95 do door1.CFrame = door1.CFrame * CFrame.new(-0.5,0,0) door2.CFrame = door2.CFrame * CFrame.new(-0.5,0,0) Part1.CFrame = Part1.CFrame * CFrame.new(0,0,0.5) Part2.CFrame = Part2.CFrame * CFrame.new(0,0,-0.5) Part3.CFrame = Part3.CFrame * CFrame.new(-0.5,0,0) Part4.CFrame = Part4.CFrame * CFrame.new(0,0,0.5) Part5.CFrame = Part5.CFrame * CFrame.new(0,0,-0.5) Part6.CFrame = Part6.CFrame * CFrame.new(-0.5,0,0)
wait() end debounce.Value = false button.BrickColor = BrickColor.new("Bright green") return end if (isopen.Value == false) then script.Parent.Open:Play() for i=1, 95 do door1.CFrame = door1.CFrame * CFrame.new(0.5,0,0) door2.CFrame = door2.CFrame * CFrame.new(0.5,0,0) Part1.CFrame = Part1.CFrame * CFrame.new(0,0,-0.5) Part2.CFrame = Part2.CFrame * CFrame.new(0,0,0.5) Part3.CFrame = Part3.CFrame * CFrame.new(0.5,0,0) Part4.CFrame = Part4.CFrame * CFrame.new(0,0,-0.5) Part5.CFrame = Part5.CFrame * CFrame.new(0,0,0.5) Part6.CFrame = Part6.CFrame * CFrame.new(0.5,0,0) wait() end debounce.Value = false button.BrickColor = BrickColor.new("Bright red") return end end end
end) |
|
|
| Report Abuse |
|
|
Flash77
|
  |
| Joined: 14 Jun 2008 |
| Total Posts: 550 |
|
|
| 21 Feb 2013 03:33 PM |
| you need to check if the clicker is an admin, right now you just have a loop for the number of admins doing nothing. |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Feb 2013 07:11 PM |
| Come on, please help me here |
|
|
| Report Abuse |
|
|
gamert7
|
  |
| Joined: 18 Nov 2008 |
| Total Posts: 4986 |
|
|
| 21 Feb 2013 07:19 PM |
Use getmouse() and add this to the top of your script:
local plr=game.Players.LocalPlayers
if plr.Name == admins then --You know the rest...
|
|
|
| Report Abuse |
|
|
|
| 21 Feb 2013 07:40 PM |
Didn't work, I tried:
p = game.Players:GetChildren()
admins = {"ROBLOXHAMTAH","LordSaturday","Firewild","hacker1leo","lumidas","TheEvidence","Lightningman911","Marinio","TDFall","Metsfan2009","Killer6199","jkoscar02","CakeTheory","trick555","poisonlava","Player1"}
door = script.Parent door1 = door.Door1 door2 = door.Door2 Part1 = script.Parent.Part1 Part2 = script.Parent.Part2 Part3 = script.Parent.Part3 Part4 = script.Parent.Part4 Part5 = script.Parent.Part5 Part6 = script.Parent.Part6 button = door.Button isopen = door.IsOpen debounce = door.Debounce
button.ClickDetector.MouseClick:connect(function() if p.Name == admins then if (debounce.Value == false) then if (isopen.Value == true) then isopen.Value = false elseif (isopen.Value == false) then isopen.Value = true end button.BrickColor = BrickColor.new("Bright yellow") end end end)
isopen.Changed:connect(function() if p.Name == admins then if (debounce.Value == false) then debounce.Value = true if (isopen.Value == true) then script.Parent.Open:Play() for i=1, 95 do door1.CFrame = door1.CFrame * CFrame.new(-0.5,0,0) door2.CFrame = door2.CFrame * CFrame.new(-0.5,0,0) Part1.CFrame = Part1.CFrame * CFrame.new(0,0,0.5) Part2.CFrame = Part2.CFrame * CFrame.new(0,0,-0.5) Part3.CFrame = Part3.CFrame * CFrame.new(-0.5,0,0) Part4.CFrame = Part4.CFrame * CFrame.new(0,0,0.5) Part5.CFrame = Part5.CFrame * CFrame.new(0,0,-0.5) Part6.CFrame = Part6.CFrame * CFrame.new(-0.5,0,0)
wait() end debounce.Value = false button.BrickColor = BrickColor.new("Bright green") return end if (isopen.Value == false) then script.Parent.Open:Play() for i=1, 95 do door1.CFrame = door1.CFrame * CFrame.new(0.5,0,0) door2.CFrame = door2.CFrame * CFrame.new(0.5,0,0) Part1.CFrame = Part1.CFrame * CFrame.new(0,0,-0.5) Part2.CFrame = Part2.CFrame * CFrame.new(0,0,0.5) Part3.CFrame = Part3.CFrame * CFrame.new(0.5,0,0) Part4.CFrame = Part4.CFrame * CFrame.new(0,0,-0.5) Part5.CFrame = Part5.CFrame * CFrame.new(0,0,0.5) Part6.CFrame = Part6.CFrame * CFrame.new(0.5,0,0) wait() end debounce.Value = false button.BrickColor = BrickColor.new("Bright red") return end end end
end) |
|
|
| Report Abuse |
|
|
| |
|
12packkid
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1418 |
|
|
| 22 Feb 2013 03:57 PM |
admins = {'BLAHBLAHBLAH"} for i,v in pairs(admins) do for i,c in pairs(players) do if c.Name == v then -- code end end end |
|
|
| Report Abuse |
|
|
|
| |
|
|
| |
|
»
»
|
|
|
|
|