Ok, so I have two scripts one is for turning my light switch on and off the other is to set it so that only group members can use the light switch. The problem is im a bit confused on how to connect them so that it works and I'm a bit confused on what to do.
Light switch script
function LightSwitchwork()
local state = script.Parent.Parent.Parent.LightState
local switch = script.Parent
local lamp = state.Parent.Light.Lamp
local light = state.Parent.Light.Lamp.SurfaceLight
local bulb1 = lamp.Parent.Bulbs.bulb1
local bulb2 = lamp.Parent.Bulbs.bulb2
local noise = script.Parent.Parent.SwitchBase.on
local noiseoff = script.Parent.Parent.SwitchBase.off
local lampnoise = script.Parent.Parent.Parent.Light.LampBase.noise
if state.Value == false then
lampnoise.Volume = 0
noise:Play()
lampnoise:Play()
state.Value = true
lamp.BrickColor = BrickColor.new("Pastel yellow")
lamp.Transparency = 1
light.Enabled = true
bulb1.Material = "Neon"
bulb2.Material = "Neon"
switch.BrickColor = BrickColor.new("Black")
switch.CFrame = switch.CFrame*CFrame.fromEulerAnglesXYZ(0,0,0.4)
else
lampnoise.Volume = 0
lampnoise:Stop()
noiseoff:Play()
state.Value = false
lamp.BrickColor = BrickColor.new("Medium stone grey")
lamp.Transparency = 1
light.Enabled = false
bulb1.Material = "SmoothPlastic"
bulb2.Material = "SmoothPlastic"
switch.BrickColor = BrickColor.new("Really black")
switch.CFrame = switch.CFrame*CFrame.fromEulerAnglesXYZ(0,0,-0.4)
end
wait(1.5)
lampnoise.Volume = 0
end
script.Parent.ClickDetector.MouseClick:connect(LightSwitchwork)
group script
local groupId = 380900
local minRank = 254
local lamp = script.Parent.Parent.Lamp
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if plr:GetRankInGroup(groupId) >= minRank then
end
end)
after the "then" i got really confused. If i could get some help i would really appreciate it. I tried reading the article that went along for group ranks but i feel like i didnt help.

2 comments
not your code eh?
no not thelight one