Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Group script does not do its function, why?

Asked by 9 years ago

So I have 2 scripts which when you click a button, the script disables another script.

Script 1 (Checker)

local function Click(Player)
    if Player.IsInGroup(group.Value) then
        script.Parent.Script.Disabled = false   
    else
    script.Parent.Script.Disabled = true
end

script.Parent.Control1.SurfaceGui.TextButton.MouseButton1Click:connect(click)

Script 2 (Door Script)

function click()
if(script.Parent.Status.Value)=="Closed" then
script.Parent.Status.Value="Opening"
movements=37
speed=0.2
for i=1,movements do
wait(0.01)
script.Parent.PLT.CFrame=script.Parent.PLT.CFrame + Vector3.new(0,speed,0);
end
script.Parent.Status.Value="Open"

elseif(script.Parent.Status.Value)=="Open" then
script.Parent.Status.Value="Closing"
movements=37
speed=0.2
for i=1,movements do
wait(0.01)
script.Parent.PLT.CFrame = script.Parent.PLT.CFrame + Vector3.new(0,-speed,0);
end
script.Parent.Status.Value="Closed"


end
end
script.Parent.Control1.SurfaceGui.TextButton.MouseButton1Click:connect(click)

2 answers

Log in to vote
1
Answered by 9 years ago

Problem 1, Missing closing for the function

function Click(Player)
    if Player.IsInGroup(group.Value) then
        script.Parent.Script.Disabled = false   
    else
    script.Parent.Script.Disabled = true
end
end
script.Parent.Control1.SurfaceGui.TextButton.MouseButton1Click:connect(click)

Problem 2, Player:IsInGroup() not . It's a function so you need :

function Click(Player)
    if Player:IsInGroup(group.Value) then
        script.Parent.Script.Disabled = false   
    else
    script.Parent.Script.Disabled = true
end
end
script.Parent.Control1.SurfaceGui.TextButton.MouseButton1Click:connect(click)

if it works loike and accept You forgot to close the function, if any other problems occur comment and I'll edit accordingly if it worked +1 and accept

local groupid = "put your group id here"
function Click(Player)
    if Player:IsInGroup(groupid) then
        script.Parent.Script.Disabled = false   
    else
    script.Parent.Script.Disabled = true
end
end
script.Parent.Control1.SurfaceGui.TextButton.MouseButton1Click:connect(click)

0
Nope TheHospitalDev 1134 — 9y
Ad
Log in to vote
-2
Answered by 9 years ago

You need a click detector, Then add a function.

Button.Lighting.ClickDetector.IfTrue then
 FindFirstChild:Destroy

Hope this helped

0
Don't need a click detector, it's a GUI TheHospitalDev 1134 — 9y
0
Oh ImmortalChamps -2 — 9y
0
You're missing so much. That script wouldn't even work. User#5978 25 — 9y

Answer this question