Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why my zombies keep spawning at the same place?

local tool = script.Parent
local RunService = game:GetService("RunService")



    
    local function onActivated()
    local zombie = game.ReplicatedStorage.Zombie
        local human = tool.Parent.Humanoid
        local mouse = game.Players.LocalPlayer:GetMouse()
    
    local e = Instance.new("Explosion")
    e.DestroyJointRadiusPercent = 10  
    e.Position = mouse.Hit.Position
    e.Parent = workspace
    
    local part = Instance.new("Part", workspace)
    part.Position = mouse.Hit.Position
    
    local clone = zombie:clone()
    clone.Parent = workspace
    local chaclone = clone:WaitForChild("Character") 
    if chaclone.HumanoidRootPart then
        clone.HumanoiRootPart.Position = part.Position
    end

    
       
    end
    
    tool.Activated:Connect(onActivated)

1 answer

✓ Accepted answer

try this:

local tool = script.Parent
local RunService = game:GetService("RunService")




    local function onActivated()
    local zombie = game.ReplicatedStorage.Zombie
        local human = tool.Parent.Humanoid
        local mouse = game.Players.LocalPlayer:GetMouse()

    local e = Instance.new("Explosion")
    e.DestroyJointRadiusPercent = 10  
    e.Position = mouse.Hit.Position
    e.Parent = workspace

   --[[
 this but isnt really needed unless you're creating something other than your zombie at the mouse.Hit.position
 local part = Instance.new("Part", workspace)
    part.Position = mouse.Hit.Position
]]
    local clone = zombie:clone()
    clone.Parent = workspace
	
    local chaclone = clone:WaitForChild("Character") 
    if chaclone.HumanoidRootPart then 

		clone:MoveTo(mouse.Hit.Position) 
        -- clone.HumanoiRootPart.Position = part.Position
    end



   -- end <<-- this needed?!

    tool.Activated:Connect(onActivated)

just swapped out moving its HumanoidRootPart with the inbuilt Model:MoveTo(Vector3)

Hope this helps! :)

1 comment

0

So if they spawn in the same place make more spawns and put more of the thing you want on the spawn

This discussion is preserved as it was. New answers, comments, and votes are closed.