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

Easy, short script malifunction?

Asked by 9 years ago

why wont this work?

script.Parent.Touched:connect(function(hit) if hit.Name == "Mouse" then game.StarterGui.a.t.Transparency = 1 end end)

2 answers

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

Modifying things in the StarterGui will modify the thing that is copied into each player upon spawn. However, it only changes the thing to be copied -- it won't change what any current players are seeing.

You'll need to loop through each player's Player gui:

for _, player in pairs(game.Players:GetPlayers()) do
    player.PlayerGui.a.t.BackgroundTransparency = 1;
end

In addition, BackgroundTransparency instead of Transparency will make the object transparent. .Visible = false would actually hide the GUI element.

Ad
Log in to vote
0
Answered by 9 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
script.Parent.Touched:connect(function(hit) if hit.Name == "Mouse" then game.StarterGui.a.t.Visible = false end end)

Transparency is not a member. However, there is Backgroundtransparency . Problem is, a fully transparent gui is still clickable. So we use the visible property instead .

Answer this question