I tried to make an NPC spawner over a GUI, and just couldn't get it to work. It breaks when I spawn it and other players can't see it could someone help me?
script.Parent.Activated:Connect(function()
local NPC = game.ReplicatedStorage.Knight
local spawner = script.Parent
local Clone = NPC:Clone()
Clone.Torso.CFrame = game.Players.LocalPlayer.Character.Head.CFrame * CFrame.new(0,0,5)
Clone.Parent = workspace
end)
game.ReplicatedStorage.RemoteEvent:FireServer()

1 comment
First, the FireServer should be inside the Activated listener. The Spawning itself should be done on the server (that is if you want other players and the server to see the NPC)