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

Why can't Image transparency from a GUI be changed inside of a touched event script?

I'm trying to figure out a way to change the properties of a GUI image inside of a touched event but when I try it just won't do anything? No errors. No thing. Just nothing happens.

script.Parent.Touched:connect(function(hit)

game.StarterGui.ScreenGui.ImageLabel.ImageTransparency = 0.5

end)

2 answers

StarterGui is only cloned into the player's PlayerGui when they join (or when they reset, if ResetOnSpawn is set to true)

after the player joins, you'll have to modify their PlayerGui to change what the ui looks like

if you want to change the gui for every player, you'll have to use a pairs loop to go through every player and change their gui

1 comment

0

I don't know how to do any of that

Oh if you dont know how to do that then i made a simple script here:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild"Humanoid" -- checks if its human
		then local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- gets player
			local playerGui = player.PlayerGui -- all you need
			playerGui.Frame.Transparency = 1 -- example
	end
end)

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