Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

0
Put your code inside a code block so it's easier to read. DevingDev 346 — 5y

1 answer

Log in to vote
1
Answered by
valchip 789 Moderation Voter
5 years ago
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!

Ad

Answer this question