Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Th3_ViR0s -15
5 years ago

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

3 answers

Log in to vote
1
Answered by
imKirda 4491 Moderation Voter Community Moderator
5 years ago

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:

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

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

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

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

Ad
Log in to vote
1
Answered by
crueluu 169
5 years ago
Edited 5 years ago

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:

01local debounce = false
02 
03local bc = BrickColor.new("Really blue")
04local part = game.Workspace.Part--refrence the part you want to be hit!
05part.Touched:Connect(function(hit)
06    if hit.Parent:FindFirstChild("Humanoid") then
07        if debounce == false then
08            debounce = true
09         print("Humanoid Touched Brick!")
10        game.StarterGui:SetCore("ChatMakeSystemMessage",{
11    Text = "You Just Touched The Sacred Brick D:";--Here You Can Change The Text To Whatever You Like!
12    Font = Enum.Font.Cartoon;
13    Color =  bc.Color;
14    FontSize = Enum.FontSize.Size18;
15    })
View all 23 lines...
0
Oh your smarter than me! good job i didn't think about this script. imKirda 4491 — 5y
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. crueluu 169 — 5y
0
No no no your not i didn't mean that, i mean really good job you are doing better than me! imKirda 4491 — 5y
Log in to vote
0
Answered by 5 years ago

.touched and chatmakesystemmessage

Answer this question