Need help with light bulb spawning on character

Hello, My name is Dash and this is my first topic created, so bare with me.

I want to make a light bulb spawn and crush you every time you say “idea man”.

It is only spawning once but when “idea man” is said again it doesn’t spawn on the players character.
robloxapp-20201125-0919055.wmv (2.4 MB)
Sorry if the video is a little laggy.

I have tried to spawn it on the character using server storage and cloning it on the local players character but it only spawns on the character once but not again.

There are no errors in the output either.
Just a little more information I was only doing this for fun so if you can’t help that’s fine.

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		plr.Chatted:Connect(function(msg)
			if msg:lower() == "idea man" then
				light:Clone().Parent = game.Workspace
				local player = game.Players.LocalPlayer
				local humanrootpart = char:WaitForChild("HumanoidRootPart")
				wait()
				game.Workspace:WaitForChild("Light").CFrame = humanrootpart.CFrame
				wait(5)
				game.Workspace:WaitForChild("Light"):Destroy()
			end
		end)
	end)
end)	

Thanks if you can help out!
-Dash

I would suggest a few things
First save the cloned lightbulb to a variable

local newclone = light:Clone()
newclone.Parent = workspace
newclone.CFrame = ...

Don’t redefine player with local player
Make sure this is a script (not a local one)

And probably remove the character added if you can figure this out, and do a check on plr.character to see if it’s actually spawned in.

(Wrote on mobile sorry)

1 Like