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

How to spawn an ncp over a gui?

Asked by
G0ZZEN 17
4 years ago
Edited by BlackOrange3343 4 years ago

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()

0
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) BlackOrange3343 2676 — 4y

1 answer

Log in to vote
0
Answered by
xXLuka_XD 103
4 years ago

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.

0
I already did this and it worked. Just gotta figure it out yourself. G0ZZEN 17 — 4y
Ad

Answer this question