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

ScreenGui is not working on screen but it is working in properties?

I have a script where when you click on a part, the screen gui will change transparency but it is not working on the screen but it is in properties. Please help. I have Gui under StarterGui. Script:

local CD = script.Parent
local Image = game.StarterGui.ScreenGui.Frame.ImageLabel
Image.ImageTransparency = 0

CD.MouseClick:connect(function(click)
	Image.ImageTransparency = Image.ImageTransparency + 1
end)

1 answer

✓ Accepted answer

The error would be on line 6

This is the fix to your code

-- Declaration Section 
--// Game Services 
local Workspace = game:GetService("Workspace")
local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")

--//StarterGui Loadout
local ChangeNameUI = PlayerGui:WaitForChild("ChangeName") --Change it to name of your ScreenGui
local Frame = ChangeNameUI:WaitForChild("Frame") --Change it to the name of your Frame inside ScreenGui
local ImageLabel = Frame:WaitForChild("ImageLabel") --Change it to the name of your ImageLabel inside the Frame. 

--//Workspace Part
local Part = Workspace:FindFirstChild("Part") --Change it to name of your part in the Workspace

-- Processing Section

local function changeFrameColour ()
	ImageLabel.ImageTransparency = 0.5
	wait()
end

-- Connecting Section 

Part.ClickDetector.MouseClick:Connect(changeFrameColour)

8 comments

0

tells me Player is a nil value at line 5

0

Is your script Local Script? Is it inside the Screen Gui? Because it needs to meet those two criteria

0

now it says infinite yield possible at line 9

0

That is because the objects you have on the explorer does not match the objects in the script. Change the names on the script to the names of the explorer and then it will work

0

What would I put on line 8???

0

Take a look at my comments in my script. If still does not work, send me an image of your explorer

0

thanks so much, sorry im a bit stupid :P

0

No problem man

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