So, I want to make a script when the player touches a brick it says something in chat.
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)