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

Can you make a word pop up in chat when you touch a brick?

So, I want to make a script when the player touches a brick it says something in chat.

3 answers

It's quite easy to do. So first you make remote event in Replicated Storage. You can make script in brick you want people to touch and put this in it:

local event = game.ReplicatedStorage.BrickTouchChatEvent -- location to the remote event
script.Parent.Touched:Connect(function(hit) -- touched function
	if hit.Parent:FindFirstChild"Humanoid" then -- checks if its human
		event:FireAllClients() -- fires event
	end
end)

What it does is that it fires event to all clients. To receive it you put local script into StarterPlayerScripts:

local event = game.ReplicatedStorage.BrickTouchChatEvent
event.OnClientEvent:Connect(function() -- receives the event
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
	Text = "Someone has touched da bricc!", -- text that it will say
	Color = Color3.fromRGB(255,0,255) -- Set any color you want
	})
end)

There is no debounce but i think you can figure it out how to make that. Hope it helps.

Here Look Make A Local Script And Place The Local Script In StarterPlayer.StarterPlayerScripts Heres the Script It Make Sure You Read The Green Coloured Text! script:

local debounce = false

local bc = BrickColor.new("Really blue")
local part = game.Workspace.Part--refrence the part you want to be hit!
part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if debounce == false then
			debounce = true
		 print("Humanoid Touched Brick!")
		game.StarterGui:SetCore("ChatMakeSystemMessage",{
	Text = "You Just Touched The Sacred Brick D:";--Here You Can Change The Text To Whatever You Like!
	Font = Enum.Font.Cartoon;
	Color =	 bc.Color;
	FontSize = Enum.FontSize.Size18;
	})
	wait(0.5)
	debounce = false
		end
		end
	
	
	
end)

3 comments

0

Oh your smarter than me! good job i didn't think about this script.

0

Sorry If I Was Being Annoying Because I Tried To Look "Smart" Even Tho I Just Started Scripting A Month Ago lol, i even sometimes get annoyed by myself.

0

No no no your not i didn't mean that, i mean really good job you are doing better than me!

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