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
4 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
4 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:

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.

Ad
Log in to vote
1
Answered by
crueluu 169
4 years ago
Edited 4 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:

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)
0
Oh your smarter than me! good job i didn't think about this script. imKirda 4491 — 4y
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 — 4y
0
No no no your not i didn't mean that, i mean really good job you are doing better than me! imKirda 4491 — 4y
Log in to vote
0
Answered by 4 years ago

.touched and chatmakesystemmessage

Answer this question