generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Need help with an admin click door

Previous Thread :: Next Thread 
Pikachucyndaquil is not online. Pikachucyndaquil
Joined: 13 Mar 2010
Total Posts: 211
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 is not online. 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
Pikachucyndaquil is not online. Pikachucyndaquil
Joined: 13 Mar 2010
Total Posts: 211
21 Feb 2013 03:52 PM
How will I do that?
Report Abuse
Pikachucyndaquil is not online. Pikachucyndaquil
Joined: 13 Mar 2010
Total Posts: 211
21 Feb 2013 07:11 PM
Come on, please help me here
Report Abuse
gamert7 is not online. 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
Pikachucyndaquil is not online. Pikachucyndaquil
Joined: 13 Mar 2010
Total Posts: 211
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
Pikachucyndaquil is not online. Pikachucyndaquil
Joined: 13 Mar 2010
Total Posts: 211
22 Feb 2013 03:55 PM
bump
Report Abuse
12packkid is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image