so whenever a player types and is 5 studs within the part then it should like show the message that he has typed and also this clones the screengui even if u are not 5 studs away it still clones it
local mic = workspace.AnnouncerTable.MIC.Main
local range = 5
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(char)
p.Chatted:Connect(function(msg)
while true do
if char ~= nil then
local torso = char.Torso
if (mic.Position-torso.Position).magnitude <= range then
local screengui = Instance.new("ScreenGui",p.PlayerGui)
screengui.Name = "Announcement"
local textlabel = Instance.new("TextLabel",p.PlayerGui:FindFirstChild("Announcement"))
textlabel.Text = msg:lower()
textlabel.Size = UDim2.new(1,0,1,0)
textlabel.TextScaled = true
textlabel.BackgroundTransparency = .8
print(p.Name.." Is close")
wait(1)
screengui:Destroy()
break
end
end
end)
end)
end)

3 comments
one more thing how do u make the cooldown thing longer
For the gui to disappear? Change the 1 on line 36. That's the wait time until it's cleared.
ok thanks