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

Zombies not move to Mouse Position. Can some one help?

I dont know why my zombies always move to one point no matter where I click can someone help`~~


local rp = game:GetService("ReplicatedStorage")
local remote = rp:FindFirstChild("Z1")
remote.OnServerEvent:Connect(function(player, val, Mouse)
    if val == "CommandZombie" then
        for i,v in pairs(workspace:GetChildren()) do
            if  v.Zombie then
                v.Zombie:MoveTo(Vector3.new(Mouse))

            end        
            
        end
    end
end)



2 comments

0

Explain your parameters

0

I posted my local script below. It is clearer

2 answers

✓ Accepted answer

You forgot to do Mouse.lookVector

local rp = game:GetService("ReplicatedStorage")
local remote = rp:FindFirstChild("Z1")
remote.OnServerEvent:Connect(function(player, val, Mouse)
    if val == "CommandZombie" then
        for i,v in pairs(workspace:GetChildren()) do
            if  v.Zombie then
                v.Zombie:MoveTo(Vector3.new(Mouse.lookVector))

            end        

        end
    end
end)

3 comments

0

let me try itt

0

error : lookVector is not a valid member of Vector3

0

error : lookVector is not a valid member of Vector3

this is my local script

local rp = game:GetService("ReplicatedStorage")
local remote = rp:FindFirstChild("Z1")
local tool =  script.Parent


tool.Activated:Connect(function()
	
			local player = game.Players.LocalPlayer
			local mouse = player:GetMouse()
			local  Mouse = mouse.Hit.Position 	

			--debounce here
			
				remote:FireServer("CommandZombie", Mouse)
				
				--debounce here
		
end)


3 comments

0

Mouse.Hit Returns CFrame so basically if you wanna use Mouse.Hit the only way you're getting away with it is basically just teleporting the zombie.

0

yea,u right. I change to Moveto and it works now

0

Using lookvector will make it walk towards well i haven't tested it but using mouse.Hit.LookVector will make it walk towards somewhere to your mouse.

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