Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Connecting script in workspace to script in StarterGui?

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()

2 comments

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)

0

Also I don't think you can directly connect a script in the workspace(server) to one in startergui(client).

1 answer

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

1 comment

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

This discussion is preserved as it was. New answers, comments, and votes are closed.