Chat bubbles spam problem

Chat bubble spam problem. How to fix?

part.TouchEnded:Connect(function(hit)
	local humanoid = game.Players:GetPlayerFromCharacter(hit.Parent)
	local character = hit.Parent:FindFirstChild("HumanoidRootPart")
	local position_buyed = workspace.position_buyed_user
	local success, currentExperience = pcall(function()
		return experienceStore:GetAsync(_G.party1_key)
	end)
	if humanoid then
		if currentExperience == "yes" then
			character.Anchored = true
			char.Humanoid:MoveTo(position_buyed.Position)
			char.Humanoid.MoveToFinished:Wait()
			wait(1)
			ChatService:Chat(Head, `Hello {humanoid.Name}, I not forget you!`, "Red") -- this
			wait(1)
			ChatService:Chat(Head, `{humanoid.Name}, You have: items`, "Red") -- this
		else
			script.Enabled = false
			sound2:Play()
			light_pointlight.Brightness = 40
			light_neon.Transparency = 0
		end
		end
		end)

Because the part touches you multiple times. Add a boolean value before the part.TouchEnded and change it whenever the player is touched once.

Example:

local canTalk = true
part.TouchedEnded:Connect(function()
if canTalk then
canTalk = false
-- ...
end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.