How do I get this path?

So i’m trying to get a quote system, making text appear over head on a button press. Can’t seem to work it cause I can’t find the head path.
SERVER SCRIPT:

local remoteevent = game.ReplicatedStorage.Quote
remoteevent.OnServerEvent:Connect(function(quote)
if game.player.Character.Head then	
	local bill = Instance.new("BillboardGui")
bill.Parent = 
local tex = Instance.new("TextLabel")
tex.Parent = bill
tex.Text = "You are... watching me?!"
local sound = game.Workspace.shadowdioquote:Clone() 
sound.Parent = 
sound:Play()

sound.Stopped:Connect(function()
   bill:Destroy()
		end)	
	end
end)

LOCALSCRIPT

local remoteevent = game.ReplicatedStorage.Quote
game:GetService("UserInputService").InputBegan:Connect(function(Input,gameProcessed)
    if not gameProcessed then
		        if Input.KeyCode == Enum.KeyCode.N then
remoteevent:FireServer("quote")			
		end
	end
	end)
1 Like

Okay, so this is a pretty simple fix.

Server Script:

local remoteevent = game.ReplicatedStorage.Quote
remoteevent.OnServerEvent:Connect(function(player) -- local script already sends the player 
if player.Character:FindFirstChild("Head") then	-- make sure the head exists
	local bill = Instance.new("BillboardGui")
bill.Parent = 
local tex = Instance.new("TextLabel")
tex.Parent = bill
tex.Text = "You are... watching me?!"
local sound = game.Workspace.shadowdioquote:Clone() 
sound.Parent = 
sound:Play()

sound.Stopped:Connect(function()
   bill:Destroy()
		end)	
	end
end)

local script

local remoteevent = game.ReplicatedStorage.Quote
game:GetService("UserInputService").InputBegan:Connect(function(Input,gameProcessed)
    if not gameProcessed then
		        if Input.KeyCode == Enum.KeyCode.N then
remoteevent:FireServer() -- Don't need to send anything to the server because it sends the player by default
		end
	end
	end)

you can’t do “game.Players.Character.Head” because the script doesn’t know what player to get, you have to define what player you want to get. In this case we don’t need to define what character we need since the local script already sends over the player by default whenever it fires the server.

1 Like

I need to parent the bill to the head, same for the sound.

1 Like
local remoteevent = game.ReplicatedStorage.Quote
remoteevent.OnServerEvent:Connect(function(player)player 
if player.Character:FindFirstChild("Head") then	
	local bill = Instance.new("BillboardGui")
bill.Parent = player.Character:FindFirstChild("Head") -- this is the line where it'll get parented to
local tex = Instance.new("TextLabel")
tex.Parent = bill
tex.Text = "You are... watching me?!"
local sound = game.Workspace.shadowdioquote:Clone() 
sound.Parent = player.Character:FindFirstChild("Head") -- this is also the line where it'll get parented to
sound:Play()

sound.Stopped:Connect(function()
   bill:Destroy()
		end)	
	end
end)
1 Like

Thank you so much! It works now.

1 Like