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

Connecting script in workspace to script in StarterGui?

Asked by 6 years ago

I have a script in a block in workspace that turns on w/ a clickdetector. Ideally I need it to change the transparency of a ScreenGui in StarterGui to 1 when clicked, but I don't know if there's any way to connect the two.

This is the script in the clickdetector, but I just don't know how to connect it with StarterGui. If anyone could help I'd really appreciate it. :)

local isOn = true
StarterGui = StarterGui.ScreenGui.Frame.ImageLabel.ImageTransparency

function on()
 isOn = true
 script.StarterGui = 0.8

end

function off()
 isOn = false
 script.StarterGui = 1

end

function onClicked()

 if isOn == true then off() else on() end

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

on()

0
Do you want this to affect the player's GUI? In that case don't use StarterGui use game.Players.LocalPlayer.PlayerGui (if it's a local script) Unbunn_makes 48 — 6y
0
Also I don't think you can directly connect a script in the workspace(server) to one in startergui(client). Unbunn_makes 48 — 6y

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

What the client see on their screen are descendants of their PlayerGui. StarterGui just allows the developer to replicate GuiInstances or client-sided scripts to a client's PlayerGui.

You can access 'PlayerGui' in a client-sided script by:

local playerGui = game.Players.LocalPlayer.PlayerGui
0
A point to add: If your game is FilteringEnabled, a server-sided(normal) script can't access the descendants of each clients' PlayerGui. However, if your game is not FilteringEnabled, you can Rare_tendo 3000 — 6y
Ad

Answer this question