Hello, I’ve been working on some commands (for example: %spawn speech) to spawn a microphone. however deleting the microphone doesn’t work.
Here’s the code:
local cake = game.Workspace.Cake
local speechstand = game.ReplicatedStorage.SpeechThrower
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg == "%spawn speech" then
speechstand:Clone().Parent = workspace
end
end)
end)
This is the script that spawns the microphone. Works completely fine.
However, the issue is when I try removing it using the “%remove speech” command
Here’s the code:
local cake = game.Workspace.Cake
local speechstand = game.Workspace:WaitForChild()
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg == "%remove speech" then
speechstand:Destroy()
end
end)
end)