Hey guys, so I generated a roblox script from the bing AI and i’m just checkin’ if this actually works! I need it for a backrooms game that I might end up making minimalistic. I forgot how to put the font for the script so here it is.
local part = script.Parent
local npcSpawned = false
local spawnPart = game.Workspace.Part – Replace “Part” with the name of the part you want the NPC to spawn at
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) and not npcSpawned then
local npc = game.ServerStorage.NPC:Clone()
npc.Parent = game.Workspace
npc.HumanoidRootPart.CFrame = spawnPart.CFrame
npcSpawned = true
end
end)
local part = script.Parent
local npcSpawned = false
local spawnPart = game.Workspace.Part – Replace “Part” with the name of the part you want the NPC to spawn at
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) and not npcSpawned then
local npc = game.ServerStorage.NPC:Clone()
npc.Parent = game.Workspace
npc.HumanoidRootPart.CFrame = spawnPart.CFrame
npcSpawned = true
-- Add this line to set npcSpawned to false when the NPC dies
npc.Humanoid.Died:Connect(function()
npcSpawned = false
end)
end