Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need your help! It's about NPC Spawning!!!please help?

game.Players.PlayerAdded:connect(function() player.Chatted:connect(function(message, recipient) if string.sub(message, 1, 6):lower() == 'spawn/' then cl = game.Lighting.Creeper:Clone() cl.Parent = game.Workspace cl:MoveTo(game.Players.LocalPlayers.Character:GetModelCFrame().p) end) end end) end end)

help pls

1 comment

0

Put your code inside a code block so it's easier to read.

1 answer

✓ Accepted answer
local NPC = game:GetService("Lighting"):WaitForChild("NPC")
local cmd = "/spawn"
local admin = "3chars20" --change to your name

game.Players.PlayerAdded:connect(function(player)
    if player.Name == admin then
        player.Chatted:connect(function(msg)
             if msg == cmd then
    i = NPC:Clone()
    i.Parent = workspace
end
        end)
    end
end)

There you go!

This discussion is preserved as it was. New answers, comments, and votes are closed.