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?
1 | script.Parent.Activated:Connect( function () |
2 | local NPC = game.ReplicatedStorage.Knight |
3 | local spawner = script.Parent |
4 | local Clone = NPC:Clone() |
5 | Clone.Torso.CFrame = game.Players.LocalPlayer.Character.Head.CFrame * CFrame.new( 0 , 0 , 5 ) |
6 | Clone.Parent = workspace |
7 | end ) |
8 | game.ReplicatedStorage.RemoteEvent:FireServer() |
First off, you are trying to spawn it off a local gui, meaning that it's a local script which means only you can see it.
Use a remote server, and fire it, and on the server clone the NPC and put it on the workspace, that's how i would do it.