ClickDetector GUI not working

I’m trying to make a script that when the player clicks with his mouse on the computer (In that case, a part that simulaters de computer) to open a GUI with the pc desktop, but for some reason that idk, it’s not working

This is the script:
local Boot = game.StarterGui.PC1:WaitForChild(“Frame”)

function onClicked()

Boot.BackgroundTransparency = 1

wait(0.1)

Boot.BackgroundTransparency = 0.95

wait(0.1)

Boot.BackgroundTransparency = 0.90

wait(0.1)

Boot.BackgroundTransparency = 0.85

wait(0.1)

Boot.BackgroundTransparency = 0.80

wait(0.1)

Boot.BackgroundTransparency = 0.75

wait(0.1)

Boot.BackgroundTransparency = 0.70

wait(0.1)

Boot.BackgroundTransparency = 0.65

wait(0.1)

Boot.BackgroundTransparency = 0.60

wait(0.1)

Boot.BackgroundTransparency = 0.55

wait(0.1)

Boot.BackgroundTransparency = 0.50

wait(0.1)

Boot.BackgroundTransparency = 0.45

wait(0.1)

Boot.BackgroundTransparency = 0.40

wait(0.1)

Boot.BackgroundTransparency = 0.35

wait(0.1)

Boot.BackgroundTransparency = 0.30

wait(0.1)

Boot.BackgroundTransparency = 0.25

wait(0.1)

Boot.BackgroundTransparency = 0.20

wait(0.1)

Boot.BackgroundTransparency = 0.15

wait(0.1)

Boot.BackgroundTransparency = 0.10

wait(0.1)

Boot.BackgroundTransparency = 0.05

wait(0.1)

Boot.BackgroundTransparency = 0

wait(0.1)

end

workspace.PcInteractive.ClickDetector.MouseClick:connect(onClicked)

image

1 Like

Ok there is something wrong. Can you also attach the light script?

1 Like

Nah, its nothing with the light, I only showed the light to demonstrate that a normal click detector is working

1 Like

(Does the script start the same way? )

1 Like

This won’t work, you will have to access the player’s PlayerGui simply by using local player

local Player = game:GetService(‘Players’).LocalPlayer
local Bool = Player:WaitForChild(‘PlayerGui’).PC1.Frame

Also I would suggest taking a look at TweenService for a fade. There was another topic I replied to that may help:

Edit: Because this script is inside the GUI you can just access the frame by doing

local Bool = script.Parent.Frame
2 Likes

This part I mean

[quote=“quebrado, post:1, topic:1074766”]

local Boot = game.StarterGui.PC1: WaitForChild (“Frame”)

function onClicked ()

If so, I knew there was something wrong there