what’s a good way of enabling a script by player?
i tried
local TextButton = script.Parent
TextButton.MouseButton1Click:Connect(function()
script.Parent.Visible = false
game.StarterGui.ScreenGui.Frame.TextLabel.Script.Disabled = false
game.StarterGui.ScreenGui.Frame.TextLabel.Visible = true
end)
but it won’t work. any alternatives
note: im trying to make a start button.
1 Like
Kaid3n22
(Kaiden)
November 14, 2021, 4:02am
2
do this for PlayerGui not StarterGui.
i dont see that in my workspace
DargoA
(DargoA)
November 14, 2021, 4:05am
4
PlayerGui is an instance under the player. Like this:
game.Players.Wseall_UTUBE.PlayerGui
Kaid3n22
(Kaiden)
November 14, 2021, 4:06am
5
It’s not something in the workspace. It is under the player. ex: player.PlayerGui
CLS0211
(Very_Evil)
November 14, 2021, 4:06am
6
It might’ve not worked because you have one Parent instead of two before the .Visible = false
the script i want to active is still located in ScreenGui though
If my calculations are correct, then this should work:
local TextButton = script.Parent
local Frame = TextButton.Parent
TextButton.MouseButton1Click:Connect(function()
TextButton.Visible = false
Frame.TextLabel.Script.Disabled = false
Frame.TextLabel.Visible = true
end)
If not, then show me a screenshot of locations of both the button and the TextLabel.
Kaid3n22
(Kaiden)
November 14, 2021, 4:08am
9
Yes, but you what you are trying to activate is not under the player, therefore meaning that it won’t affect the player.
DargoA
(DargoA)
November 14, 2021, 4:10am
10
When a player joins, all the things that are in the StarterGui will be replicated into each individual player’s PlayerGui. So you need to replace your code with this:
local TextButton = script.Parent
local Player = game.Players.LocalPlayer
TextButton.MouseButton1Click:Connect(function()
script.Parent.Visible = false
Player.PlayerGui.ScreenGui.Frame.TextLabel.Script.Disabled = false
Player.PlayerGui.ScreenGui.Frame.TextLabel.Visible = true
end)
the script still doesn’t work…
CLS0211
(Very_Evil)
November 14, 2021, 4:11am
12
Try this:
local p = script.Parent
local g = game.Startgui.ScreenGui.Frame
p.MouseButton1Click:Connect(function()
p.Parent.Visible = false
g.TextLabel.Visible = true
g.TextLabel.Script.Disabled = false
end)
Also make sure it’s a local script
check the script, it still doesn’t work. its like roblox blocked unlocking scripts by code
Ioveczour
(Sulo)
November 14, 2021, 4:14am
14
Can you send me the location (picture) of the TextLabel and TextButton? I tried telling you that earlier, but my message went through for moderation…
CLS0211
(Very_Evil)
November 14, 2021, 4:15am
15
Are there more than one Frame and/or TextLabel, having two of the same makes the lua script not work.
DargoA
(DargoA)
November 14, 2021, 4:15am
16
Did you use my solution from the post above?
its in starter gua.frame.text button next to text lable. script
CLS0211
(Very_Evil)
November 14, 2021, 4:18am
18
Do you have the frame in a ScreenGui?
doesnt activate the script for the game
yes i do have the frame in a ScreenGui