Quote script not working

I’m trying to make a script on pressing N, text appears over their head and an audio plays, but I want it to get deleted after aswell. Text does not appear either.
The text does not appear, and it doesn’t delete its self after it finishes.
SERVER SCRIPT:

local remoteevent = game.ReplicatedStorage.Quote
remoteevent.OnServerEvent:Connect(function(player) 
local bill = Instance.new("BillboardGui")
bill.Parent = player.Character:FindFirstChild("Head") 
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")
if player.Character:FindFirstChild("Head") then	
local sound = game.Workspace.shadowdioquote:Clone() 
sound.Parent = player.Character:FindFirstChild("Head")
sound:Play()
	end
game.Workspace.shadowdioquote.Stopped:Connect(function(Deletesound)
			   bill:Destroy()
			tex:Destroy()
			sound:Destroy()
	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)
local remoteevent = game.ReplicatedStorage.Quote
remoteevent.OnServerEvent:Connect(function(player)
	local head = player.Character:FindFirstChild("Head")
	local bill = Instance.new("BillboardGui")
	bill.Parent = head
	bill.StudsOffset = Vector3.new(0,2,0)
	
	local tex = Instance.new("TextLabel")
	tex.Parent = bill
	tex.Text = "You are... watching me?!"
	
	local sound = workspace.shadowdioquote:Clone() 
	sound.Parent = head
	sound:Play()
	
	sound.Stopped:Connect(function()
		bill:Destroy() -- "tex" is in bill, no need to destroy both
		sound:Destroy()
	end)
end)

Try this.

Your script was very sloppy over-all, so here’s some changes I made:

  • You cloned the Sound twice, and then didn’t identify it when using .Stopped, I’ve removed one of the clones and hooked up the Stopped function to the clone itself.
  • You didn’t set the BillboardGui.StudsOffset which, from your post, seems like you’re camera is too close and the GUI is being hidden inside of the head itself.

I’m on phone so I can’t properly test this, but if it doesn’t work could you supply a video of the event not functioning? (to what extent it neglects to function)

1 Like

https://streamable.com/7l2etp (No text appearing)
https://gyazo.com/4dc93cab07396bb90cbd3e59d69e826c (The things that won’t get deleted.)

You there? It’s been a day.

(30 character limit)