Billboard GUI appears on everyone's head

I am trying to do a chat system
when the player clicks ‘SEND’ button local script activates RemoteEvent and it should clone a message bubble to a player’s head
But instead it clones this bubble to everyone’s head
any ideas why?

local script

local Event = game:GetService("ReplicatedStorage"):WaitForChild("FilterMessage")
local send = game:GetService('ReplicatedStorage'):WaitForChild("Chat")
local Input = script.Parent.Parent.TextBox
local Submit = script.Parent
local cooldown = false
local player = game.Players.LocalPlayer




local function buttonClicked()
		
		if Input.Text ~= "" then
		cooldown = true
		Event:FireServer(Input.Text)
		Input.Text = ''
		Submit.Visible = false
		wait(5)
		Submit.Visible = true
		cooldown = false
		elseif Input.Text == '' then
			cooldown = true
			Event:FireServer('...')
			Submit.Visible = false
			wait(5)
			Submit.Visible = true
			cooldown = false
		
			
		
	end
end

local function onClientReceive(message)
	send:FireServer(message)
end

Submit.MouseButton1Down:Connect(buttonClicked)
Event.OnClientEvent:Connect(onClientReceive)


--the uhhh enter function
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input)


	if input.KeyCode == Enum.KeyCode.Return then
		if cooldown == false then
			cooldown = true
			buttonClicked()
			Submit.Visible = false
			wait(5)
			cooldown = false
			Submit.Visible = true
		end
		
	end
end)

UserInputService.InputBegan:Connect(function(input, focused)
	if focused then
		return
	end
	if input.KeyCode == Enum.KeyCode.Slash then
		script.Parent.Parent.TextBox:CaptureFocus()
	end
end)

server script (the one that clones the message)

local chattingevent = game.ReplicatedStorage:WaitForChild('Chat')
local cooldown = false
chattingevent.OnServerEvent:Connect(function(plr, text)
	if cooldown == false then do
		local chat = script.chat
	local billboard = plr.Character.Head:WaitForChild('BillboardGui')
	billboard.ExtentsOffset = Vector3.new(0, 4, 0)  
	chat.TextLabel.Text = text
	local cloned = chat:Clone() 
	cloned.Parent = plr.Character.Head
	wait(5)
	billboard.ExtentsOffset = Vector3.new(0, 2, 0)  
	cloned:Destroy()	
		end
	end
	
	
end)
1 Like

i dont rlly know why this is happening but maybe try sending the players username to the sever so it doesnt get confused

i tried, but it sets the text value as player name and vice versa

what’s the pathing for the server script? as in where it’s located

^ In the server script, this is the remote event you are listening to

^ In the local script, this is the function that fires the remote mentioned above

^ And finally, this is the line that connects the above function with the client event

I would look at what script is firing the client event (you didn’t show it), and make sure it’s only sending to the intended client, and not all clients.

Seems like there’s a lot of ping pong between the server and client. Would also try to see if that can be minimized.

Alright, i will find it when i get back home

sorry for bothering anyone, i found the answer (i wrote the script but deleted some useless stuff)

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