pos = game.Workspace.moving.Position
while true do
wait()
game.Workspace.Model.Humanoid:MoveTo(Vector3.new(pos))
end
the script above should make a humanoid move to a part. in the output, it says moving is not a valid member of workspace. and it isnt. because when the player selects a tool, the part called moving gets created. but the humanoid does not move. and i tried putting everything inside of the while true do, but it didnt help.
player = game.Players.LocalPlayer
mouse = player:GetMouse()
tool = script.Parent
local function onEquip()
brick = Instance.new("Part",game.Workspace)
brick.BrickColor = BrickColor.new(1020)
brick.Name = "moving"
brick.Size = Vector3.new( .01, 4, 4)
brick.Shape = "Cylinder"
brick.Anchored = true
mouse.TargetFilter = brick
mouse.Move:connect(function()
if mouse then
brick.CFrame = CFrame.new(mouse.Hit.X, mouse.Hit.Y, mouse.Hit.Z)
brick.Rotation = Vector3.new(0,0,-90)
end
end)
end
tool.Equipped:connect(onEquip)
tool.Unequipped:connect(function()
brick:Destroy()
end)
this is the part script, it makes the part go wherever the mouse goes.
