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

How do I make a GUI dissapear OnTouch?

I tried

function game.Workspace.StarterGui.ScreenGui: destroy(OnTouch)
end

How can I fix this?

1 answer

✓ Accepted answer

If you're trying to remove the GUI from the player that touched the brick, then this is how you would do it:

function onTouch(Obj)
	if Obj.Parent:FindFirstChild("Humanoid") then
		local Player = game.Players:GetPlayerFromCharacter(Obj.Parent)
		if Player then
			if Player.PlayerGui:FindFirstChild("PUT GUI NAME HERE") then
				Player.PlayerGui["PUT GUI NAME HERE"]:Destroy()
			end
		end
	end
end
Game.Workspace.Part.Touched:connect(onTouch) --Change "Game.Workspace.Part" to what object you want the player to touch

Hope this helped!

1 comment

0

Thanks :D

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