I have a game i'm working on, and i've been trying to spawn in different models, but it always spawns in the amount of players there are.
--localscript
local RemoteEvent = game.ReplicatedStorage.npc1
local Button = script.Parent
local debounce = false
Button.MouseButton1Up:Connect(function()
if debounce == false then
debounce = true
RemoteEvent:FireServer()
wait(1)
debounce = false
end
end)
--globalscript
local debounce = false
local DIST_FROM_PLAYER = 20
local RemoteEvent = game.ReplicatedStorage.npc1
RemoteEvent.OnServerEvent:Connect(function(player)
character = player.Character
Mod = game.ServerStorage.NPC1 --Change test to whatever you have named the Model/Item you want to spawn
clone = Mod:clone()
clone:SetPrimaryPartCFrame(CFrame.new(character.PrimaryPart.CFrame.Position+(DIST_FROM_PLAYER*character.PrimaryPart.CFrame.LookVector)))
clone.Parent = workspace.zombies
wait()
end)
Both the localscript and globalscript are in the gui button. Thank you!
