i tried to make a stand and stuff i need help with a code please
Ok, in order to do this you are gonna use a RemoteEvent. In the localscript inside of the textbutton to spawn the NPC put the following:
local rem = game:GetService('ReplicatedStorage'):WaitForChild('SpawnNPC') --This gets our remote event script.Parent.MouseButton1Click:connect(function() rem:FireServer() --Fires it end)
now in the ServerScriptService, put the following in a script:
local remote = game:GetService('ReplicatedStorage'):WaitForChild('SpawnNPC') remote.OnServerEvent:connect(function() local npc = game.ReplicatedStorage:WaitForChild('Soldier') --Our NPC in this case is a soldier npc:Clone().Parent = workspace --Spawns the NPC into workspace end)
I hope this helps you out, but please remember that this isn't a request site and the next time you have a question put in your code so we can help you out
Closed as Not Constructive by NiniBlackJackQc, Torren_Mr, and User#5423
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?