Chat message and dissapearance on touch of a brick

Hello developers!
As you probably know, it is easter tomorrow!
Our family has this tradition where everyday, we go seek easter eggs together!

This year is a bit different for us, since my neices’ teacher has gotten the virus. My neice is not allowed to leave the house now, so we can not seek eggs together.

My mom got this (genius) idea tomorrow that I could maybe make a game where we can seek eggs together. Almost everyone in my family has got a roblox account so I thought this was a really good idea!

I can make every part of the game myself, other than a few scripts. That’s why I fugured to ask for help here!

What I need:

I need a script that puts a green text in the chat on touch of a part. The text will be this: [Username] found [Part name]!

The script then has to put the part’s transparency to 1, so the egg can’t be found again.
Only the touched part has to become transparent, because it can be possible that multiple parts have the same name. The script must only be able to be triggered once.

Thanks for helping me out!

2 Likes

Update: With some help from free models I was able to create this:

local touchPart = workspace.TouchPart
local plrName = game.Players.LocalPlayer.Name
local debounce = true

touchPart.Touched:Connect(function(hit)
	if debounce == true  and hit.Parent:FindFirstChild("Humanoid") then
		debounce = false
		local name = hit.Parent.Name
		game.StarterGui:SetCore("ChatMakeSystemMessage",
			{
				Text = ""..name.." has found an egg!",
				Color = Color3.fromRGB(0, 255, 0),
				Font = Enum.Font.SourceSansBold,
				TextSize = 18,
			}
		)
		debounce = false
	end
end)

Which kind of works, but it relies on the name of a part and doesn’t make it disappear.

you can use this video for the egg message
just change the message from completed level to found egg

here is a script to make a part disappear onTouch

local part = script.Parent
local function onTouch()
    part.Transparency = 1

end

part.Touched:Connect(onTouch)

:smile:

I’ll try this out! Thanks!

Edit: This is perfect! Thanks!

hope it works

remeber to place the script into the part

you can change the variable name if you want

Thanks! it works perfectly!
The part name does not matter much anymore, since I can just use egg1, egg2, egg3, etc.

Thanks again!

no problem Happy to help :grinning:

Hope you and your family have a fun easter

1 Like