xMrBossy
(MrBossy)
May 18, 2022, 2:09pm
#1
What do you want to achieve?
I want to make a Presentation screen, when an admin presses the “Show Panel” button, two panels appear.
What is the issue?
Only some parts appear.
What solutions have you tried so far?
I tried deleting some lines and looking it up.
Also, I’m new to scripting so I don’t know much.
Here’s the script:
script.Parent.MouseButton1Click:Connect(function()
game.Workspace.PreScreen.PreScreenFrame.Transparency=0
game.Workspace.PreScreen.PreScreenFrame2.Transparency=0;
game.Workspace.PreScreen.PrescreenFrame3.Transparency=0;
game.Workspace.PreScreen.PreScreenFrame4.Transparency=0;
game.Workspace.PreScreen.PreScreenFrame5.Transparency=0;
game.Workspace.PreScreen2.PreScreenFrame.Transparency=0;
game.Workspace.PreScreen2.PreScreenFrame2.Transparency=0;
game.Workspace.PreScreen2.PreScreenFrame3.Transparency=0;
game.Workspace.PreScreen2.PreScreenFrame4.Transparency=0;
game.Workspace.PreScreen2.PreScreenFrame5.Transparency=0;
game.Workspace.PreScreen.PreScreenFrame.CanCollide=true;
game.Workspace.PreScreen.PreScreenFrame2.CanCollide=true;
game.Workspace.PreScreen.PreScreenFrame3.CanCollide=true;
game.Workspace.PreScreen.PreScreenFrame4.CanCollide=true;
game.Workspace.PreScreen.PreScreenFrame5.CanCollide=true;
game.Workspace.PreScreen2.PreScreenFrame.CanCollide=true;
game.Workspace.PreScreen2.PreScreenFrame2.CanCollide=true;
game.Workspace.PreScreen2.PreScreenFrame3.CanCollide=true;
game.Workspace.PreScreen2.PreScreenFrame4.CanCollide=true;
game.Workspace.PreScreen2.PreScreenFrame5.CanCollide=true;
game.Workspace.PreScreen2.Screen.CanCollide=true
game.Workspace.PreScreen.Screen.CanCollide=true;
game.Workspace.PreScreen2.Screen.Transparency=0;
game.Workspace.PreScreen.Screen.Transparency=0;
end)
1 Like
May I just say ur code is really messy. The best way to do this would just to put all the parts in a model and then loop through them all. Would make the code more neat.
Also why do you have the “;” at the end of each of the property changes. In lula you don’t need the “;” at the end.
xMrBossy
(MrBossy)
May 18, 2022, 2:18pm
#3
It was one of the things I tried to fix it.
Yea some languages require you to use semi colons but Lua is not one of them.
Can you show me your workspace (how the different screen things are organised) Ignore this
Ok here I made some simple code which should work:
local PreScreen2 = game.Workspace.PreScreen2
local PreScreen = game.Workspace.PreScreen
local button = script.Parent
button.MouseButton1Click:Connect(function()
for i, v in pairs(PreScreen:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 0
v.CanCollide = true
end
end
for i, v in pairs(PreScreen2:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 0
v.CanCollide = true
end
end
end)
Please note that it seems like your doing this code inside of a local script which would mean that the screens will only show for the admin who clicked the button! If you want everyone to do this you would need to use a remote event to do this code in the server side!
1 Like
xMrBossy
(MrBossy)
May 18, 2022, 2:32pm
#7
Okay, I will try this.
And, no the script is a normal script.
You really should not be doing things related to UI in side of a server script (e.g MouseButton1Click).
xMrBossy
(MrBossy)
May 18, 2022, 2:33pm
#9
I will use remote events for UIs.
And yayyy your script worked. tysm.
1 Like
Great to hear it worked! If you use remote events just ensure you protect your server (e.g checking the user who the event comes from is an admin)
If your not use how to protect your server here is a tutorial I made:
How to protect your server from exploiters tutorial!
Greetings everyone!
So recently I have seen quite a few peoples code which uses things like remove events and as such but they have not protected the server well. Due to this I decided to write a detailed tutorial onto this. Inside this tutorial I will be including how exploiters can use things like remote events to hack your game, best ways to protect your server from exploiters and some examples of ways you can protect your server. I will …
1 Like