Here is my script

local Object = game.Lighting.NPC:Clone()
local cloneMade = script.Parent.Parent.Parent.cloneDoingMaze

function startNPC()
	Object.Parent = game.Workspace
end

script.Parent.Touched:Connect(function()
	if cloneMade == false then
		startNPC()
		wait(0.1)
		cloneMade = true
	else
		script.Parent.Parent.Name = "There is already an npc doing the maze"
	end
end)

4 comments

0

First off, don't store things in Lighting; put them in ServerStorage.

0

Sorry its how i learned scripting :/ ill start doing that

0

Also, if "cloneMade" is a BoolValue instance then you need to add ".Value" when referring to its value property, otherwise you will be referring to the instance itself.

0

Im stupid i forgot to add that xd thanks for pointing that out